Code Academy Week 2 – A Taste of Rails

Week 2 was our introduction to the basics of rails. I don’t remember what happened on Monday, but on Wednesday, Neal laid the smackdown on our brains with Class data manipulation. Basically, if you have a philosophy background, think of a Class as a Platonic ideal – I am a Man, a Man is a Human, a Human is a Mammal, etc.

Or, if you prefer biology, it’s much like taxonomy. A Man is a Human, which is a Mammal:

Mammal

  • Has fur
  • lactates
  • gives live birth

Human

  • hair mostly grows on top of head
  • bipedal
  • tool user

Man

  • broad shoulders
  • protruding brow ridge
  • deep voice

Man < Human < Mammal

Each of the subclasses “inherits” the traits of the parent class, meaning it has the parent class’s traits plus some other ones. The weird part is that we define every aspect of our classes in Ruby, so we’re essentially creating worlds. Each Controller, which I’ll explain later, is a class with traits and specific commands.

Anyway, long story short, Wednesday felt like someone had mentally socked me in the face three times, but I came out with a good understanding of classes. I was fairly familiar with the concepts at a high level, though, so I feel bad for others who weren’t so lucky.

Today was a much more gentle introduction to Routes, Controllers, and Views. Basically, a Route is the extra slashes in the URL: “google.com/something/here”. The web site server receives that Route from you and interprets it as a command, handing it off to the Controller, which determines what information you’re actually requesting. It then hands that information to the View, which is the final end product that you see load in your browser. If you right click a website and click “view source,” you’re basically looking at a View, but not the logic behind how the HTML was generated (Controller).


Everything started to click when we built one of those Route -> View -> Controller event chains. Now I understand where to start, how to use error messages to continue forward, and I have a more intuitive understanding of where everything goes. I will probably build some routes for fun, just to explore Rails and really hammer it in.

In other news, I’ve been totally ignoring the homework and doing my own thing. Probably a bad thing because the homework is relevant to what’s been discussed in class, but I’m going through Agile Web Development on Rails at my internship and pairing, so it’s a trade-off.

Oh, speaking of which, I paired with Greg Cardoni, an awesome individual who graduated last quarter. He gave me a tour of Digital Schoolhouse, the project that he and three other alumni worked on together. He also gave me a beer that I actually liked, which was really surprising. What was that beer?

Met up with my Code Academy mentor, Eric Meyer, an 8th Light Craftsman (I believe), and we paired on a simple blog application. There were a few times when I just clearly did not know what I was doing when he expected me to, but that gap will close as the days pass.

Finally, I think I’ll be building a blog as a breakable toy, perhaps with my classmate Dan Kaplan. Either way, it’ll be on github.