Learning Rails 3
Update: I have since been able to review the first edition (with complete content).
The Rails 3 framework has brought quite a lot of new, sexy features which in turn has prompted many people to learn to use the framework. But where should you start? Luckily, there are many great resources dedicated to Rails newbies, and below, I’ll compare two of them: Agile Web Development with Rails (AWD, no longer sold) and Rails 3 in Action (R3A, now available to read free online). (If you just want to dip your toes in the Rails flavored water without investing in a guidebook, check out the Ruby on Rails tutorial, which is available online at no cost.)
Setup
Both books will walk you through setting up Rails, but each with its own approach: AWD spends a lot more time detailing the specific steps and commands for each platform (Linux, Mac, Windows), while R3A spends one page (literally) to point you to the relevant guides that can be found online. Neither is better or worse, but most readers will usually prefer one style over the other.
Both books teach Rails by developing a Rails app throughout, and introduce Git as the source code management system to use. R3A, however, goes into more detail here, going as far as covering how to configure a remote repository on GithHub. Seeing source code management being given more than a passing mention is definitely a pleasant surprise.
Developing the app
Each book guides you along developing an application, and introduces new concepts and features incrementally.
R3A sticks consistently to Behavior-Driven Development and systematically codes up Cucumber features before adding new code, which is a great reflex to acquire (and will lead to more maintainable code down the road).
On the other hand, in my opinion, the code listings in AWD are more legible and convenient (they include a hyperlink to download the relevant code snippet).
The differences
I find AWD more legible, especially on a screen [1]. In addition, the various hyperlinks (to code snippets, other section in the book, etc.) are really handy. AWD also includes a handy “Rails in depth” section that can serve as a beginner’s reference, explaining various Rails concepts and components.
R3A presents a much wider range of topics: Cucumber, FactoryGirl, CanCan, how to implement your own API, Rails Engines, etc. Depending on your level of “n00bness” it will be quite a lot to take in, and might overwhelm you. The upside is that if you are in fact able to fully understand all the components discussed in R3A, you’ll be able to develop real world applications. (Whereas AWD will require a little self-study to increase your knowledge before you can move on to the more demanding applications.)
Conclusion
So which book should you get? Well, the approach is sufficiently different that you’d benefit from reading both (I’d suggest starting with AWD, then moving onto R3A). That said:
- if you need a little more hand holding, go with AWD: it introduces the MVC architecture, Ruby, and other concepts in a gradual way such that you can understand them by reading only the material contained within th book;
- if you’ll gladly do some independent research on the web in exchange for being exposed to developing web applications using tools from the Ruby/Rails ecosystem (Git, Cucumber, Factory Girl, Devise, and friends), then go with R3A.
AWD is better at teaching Rails to a complete Rails neophyte (or slower learners), while R3A teaches more concepts, in addition to more advanced ones (such as APIs, engines, role-based access control). So while R3A will provide too much content for a complete newbie to take in (due to both volume and breadth), it will be perfect for someone who has read a few introductory articles on Rails (maybe even tried an example or two) but is still uncomfortable with Rails and wants to learn it “for real”.
If you have trouble multiple concepts simultaneously, you’re probably better off with AWD: it introduces less “other stuff” so that you can focus on learning Rails. (Just be aware that you will need to learn this additional material to implement the more advanced applications.)
Given the application developed in R3A is much closer to a real world application (in both feature scope and development methodology) than the one developed in AWD, R3A provides a significant value for money; provided you are far enough along the learning process to take advantage of it (or can easily absorb large amounts of new information). In fact, if you plan on buying only one Rails book, make it R3A: although the learning curve can be quite steep, it will take you much longer to outgrow the content, and any concepts you have trouble learning can be shored up with a quick web search.
One missed opportunity in R3A is the lack of coverage of jQuery. Given that Yehuda Katz is simultaneously co-author of the book and a member of the jQuery core team, and that jQuery will be the default javascript library in Rails 3.1, it is unfortunate the subject is completely absent from the book [2]. (Even AWD gives jQuery a quick 3-page mention.)
All in all, you’ll be pleased with your book regardless of your choice: any concepts you can’t quite grasp, or that are missing from one book or the other, can easily be acquired from easily accessible resources (such as Rails guides, or Stack Overflow).
[1] Although I was provided with an advance copy that hadn’t been proofread or formatted, this preference isn’t due to the “work in progress” status. Instead, it’s related to the font, its size, and the general page layout. Of course, your mileage may vary.
[2] It might possibly be covered in “Appendix B: Things that couldn’t go elsewhere”, which wasn’t available at the time of this review.
Full disclosure: Manning Publications was kind enough to provide me with an advance copy of the Rails 3 in Action book, free of charge. It goes without saying that this has in no way affected my opinion.
Would you like to see more Elixir content like this? Sign up to my mailing list so I can gauge how much interest there is in this type of content.