On the Floor
Don't Forget the "Ruby" in "Rails"
When you start to learn how to craft websites with Rails, one of the common pieces of advice you get is: "Learn Ruby first. Then learn Rails." It's great advice, but everyone ignores it. Don't feel bad if you did; I did too.
To understand why it's great advice, you need to translate the statement a little bit. To my naive mind, "Learn Ruby first" was equivalent to "Learn how to write a program in Ruby first", which was equivalent to "Learn Ruby syntax first". As a Ruby n00b (via PHP), this made sense, what with Ruby's crazy symbols and blocks and use of pipes. And then, I sort of thought, "Well, if I'm writing a Rails app, that is a Ruby program, so I'll just learn all this as I go." Hey, it worked for PHP, right?
But the unstated assumption in this piece of advice is "Learn to program an object-oriented application properly." Then learn how to do that with Ruby. Then learn Rails.
The thing about Rails is that it is an opinionated piece of software. That's awesome. You know, the whole "convention over configuration" thing which makes using Rails so great. But, if you are teaching yourself how to write object-oriented programs based on the Rails conventions, you will force yourself into some awkward corners and will make bad design decisions. Sure, your code works, but you can tell things aren't quite right when you try and maintain it.
Luckily, because everyone ignores that advice, there are plenty of people out there trying to help us out. Here are some great resources I am constantly consuming and re-consuming:
"The Secret to Rails OO Design" by Steve Klabnik
A much better version of this very blog post. I can't believe I read this a half a year ago and basically ignored it.
"Design Patterns In Ruby" by Russ Olsen (currently ~$47 on amazon.ca or ~$33 on amazon.com, even though the Canadian Dollar is currently worth more than the American one...)
So, you're starting to buy into this OO thing? Read this book to quickly improve your Ruby code.
"Objects on Rails" by Avdi Grimm - $5
Now that we know all that stuff, let's watch a master apply this to an entire Rails app.
"Destroy All Software" by Gary Bernhardt - $9/month
There is more to learning to program properly than just writing awesome code. You should also be able to manage your meta-coding like a master. Version control, testing, using your text editor, all this stuff is important. And OMFG is Gary Bernhardt the master of this stuff. Trust me: $9 a month is totally worth it to watch this guy do his stuff.
Posted by Marc Kelsey ♦ April 26 2012 at 11:06AM ♦ Permalink ♦