
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
♦
Subscribe 
Follow us on
Twitter 
Archives
May 2013April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
June 2009
March 2009
January 2009
December 2008
November 2008
September 2008
August 2008








Comments
This is more rails than ruby, but I'd like to make mention Michael Hartl's work:
http://ruby.railstutorial.org/ruby-on-rails-tutorial-book
I've yet to do any major work with rails, but I've had fun with this tutorial. There are some best practices in there needed to secure a rails app that can't be glossed over! (see github's problem a few months ago)
Whoa, that looks pretty comprehensive! That is definitely a good addition to the list. Thanks!