Learning Ruby and Rails
I live in a town dominated by Python, PHP, and Java developers, so hiring someone who can come in and write Ruby code from day one is a challenge. I’ve been thinking about how I learned Ruby myself, how I’ve gone about helping others learn it, and what I would do differently if I had to do it all over. Meanwhile, last week Mashable polled several notable Rubyists about how newcomers should get started with the language. Since the topic has been on my mind, too, and I’m not notable enough for major tech blogs, I’m going to share my thoughts here. I’d be interested in your feedback, as I hope to eventually have a set of go-to resources for new employees and other would-be Ruby and Rails developers.
Start with Rails
Some Rubyists suggest that the way to learn the language is to pick up a Ruby manual, go through the traditional Hello World tutorials, and go from there. I disagree—I think the best way to get running is to learn Rail. You’ll get a framework that lets you build complete projects quickly, and observe many Ruby best practices in the process. I believe this applies whether you’re coming from other language frameworks that may lack some of Rails’ ease of development or, like me, from an anything goes approach to web application development.
When I got started the selection of resources for learning Rails was relatively limited compared to today’s veritable library. I picked up a copy of Agile Web Development with Rails (then in its first edition), worked my way through the online store tutorial (with much more real world applicability than Hello World), and began developing real, productional applications at my day job. These days I think Agile Rails (now in its third edition) is still a good primer, though Michael Hartl’s Rails Tutorial might be a better way to go because it does a better job of embedding common tasks like testing, version control, and deployment. (Hartl’s book was recently released in print form if you’d prefer to read it in that format.)
There are also some recently-updated screencasts from Peepcode covering Rails 3. I haven’t reviewed these, but generally speaking, I like the Peepcode series provided I watch them in a timely manner. Some of their older offerings haven’t aged well in my opinion.
Next, focus on Ruby
Once you’ve learned how easy it is to use Rails to build full-featured web software, it’s time to go under the hood and understand more about how some of that Rails magic actually works. (I’ve seen people develop complete Rails apps with very little Ruby understanding, or at least an understanding of where Rails ends and Ruby begins, but that’s probably not a sustainable practice.) Now’s the time for Hello World and Ruby shell scripts. I’m still a fan of Pragmatic Programmers’ Programming Ruby: The Pragmatic Programmers’ Guide. The third edition covers Ruby 1.9; if you’re in a development or production environment still using 1.8 you can grab the second edition (or pick up a used copy of it cheaply).
There are a ton of free Ruby books out there (and even more) if you’d like to learn more without spending a lot of money. I think Jeremy McAnally’s Mr. Neighborly’s Humble Little Ruby Book is a good primer, albeit for an older version of Ruby.
Branch out from Rails
From there, I think you’ll have good footing from which to expand your Ruby palette, whether you’re checking out other web frameworks like Sinatra, using Ruby to automate system tasks through shell scripting, or writing your own Mac OS X software with MacRuby.
Rails has evolved enormously since its debut, and interesting new Ruby projects spring up daily. Whether it’s an upgrade to your favorite gem, a new gem that does something a little better, or a whole new framework to check out, there’s always something new to learn in Ruby. Luckily there are some excellent blogs, podcasts, and link sharing services to help you keep up and keep your Ruby skills honed.
As you probably already know, Railscasts is the podcast to check out every week to keep building your Rails skills. I watch it even when I don’t have an immediate need for what’s being presented—it’s an excellent, free way to see how a Ruby expert gets things done. Plan to spend 15 minutes or so following along each week. You can also follow along via ASCIIcasts, the text transcriptions of each week’s tutorial.
Other podcasts are less tutorial in nature and more about what’s new in Ruby: Ruby5, The Ruby Show, and The Changelog all provide regular updates on the Ruby world, new gems, and other projects you should be aware of. Each show also provides a list of links discussed in that episode, so even if you don’t have time to listen you can still check out what’s new.
How about a good old fashioned e-mail newsletter? Check out Ruby Weekly for a weekly dose of Ruby news in your inbox. I like Ruby Weekly because it helps me follow up on things I may have missed throughout the week, or serves to reinforce things I should have checked out.
Everyday Rails Testing with RSpec: The book
If you liked my series on practical advice for adding reliable tests to your Rails apps, check out the new, expanded ebook version. Lots of additional, exclusive content and a complete sample Rails application. Get it now for only $12 or learn more about the book.