Review: Build Your Own Ruby on Rails Web Applications
I was recently sent a copy of Patrick Lenz’s Build Your Own Ruby on Rails Web Applications, published by SitePoint. While I am certainly not in its target audience, I still found the book’s style refreshing, and even learned something about Rails I didn’t know before! (The
debug helper, for inspecting models in your views.)
The book is marketed as “the ultimate beginner’s guide to Ruby on Rails”, and while I don’t know that I would go quite that far, it is definitely a good introduction, especially if you are new to Ruby. I felt it spent about three or four chapters too many on introductory matter (you don’t really start doing anything with Rails itself until chapter 5) but once the book gets started it does a good job of helping you get a new Rails application off the ground.
- It was written for Rails 1.2, making it one of the few books available covering the newest version of the framework.
- It encourages unit and functional tests. Patrick mentions TDD, but does not follow it in the book, which is probably for the best in a book targeting people with little prior programming experience. Instead, each chapter ends with a section in which he walks through the process of adding tests for the features added in that chapter. Effective, but only as a step towards learning better testing practices.
- It makes good use of the code generators and migrations, demonstrating their strengths well.
- It shows how to implement a basic user authentication system without resorting to plugins! Far, far too many newcomers to Rails jump on the user-auth plugin bandwagon, which leads to cargo-culting. My advice is: never use a plugin you would not be able to write yourself. (Later in the book Patrick uses the acts_as_taggable plugin to implement tagging, but ultimately the point of the chapter was to show how to use plugins.)
- It walks you through setting up your first production environment. Although it doesn’t use Capistrano (which would be well beyond the scope of the book), it does mention Capistrano, as well as many other possible deployment environments (including SCGI, Mongrel, nginx, and more).
So, are you new to Ruby and Rails? Want to learn how to write dynamic web applications? This book will suit you nicely. However, if you have prior experience with building Rails apps, you’ll probably find this book too simple for your own needs.
Great work, Patrick! And congrats on getting a book based on Rails 1.2 out the door so quickly.
Given Patrick’s experience supporting high-traffic sites built with Rails and other frameworks (freshmeat.net, eins.de), I was hoping he would have a chapter on that.
Hopefully that will be his next book!
21 Feb 2007
I’m curious why you advise never using a plugin one couldn’t write oneself.
I understand the benefits of being able to understand and write the plugins, but I don’t really see the cost of not being able to do so (assuming one just uses them rather than needing to modify them).
And even those cargo-cult scallywags are at least not wasting energy reinventing the wheel over and over again.
Would you also argue that one should be capable of writing Rails itself in order to use it? Just curious…!
22 Feb 2007
thanks for the kind words. Oh, and thanks for also defending the book’s refusal to deal with restful application design (given the book’s audience) in the Amazon.com comments :)
22 Feb 2007
Out of curiosity, how do you feel this book compares to Agile Web Development with Rails? I have that book and have worked through about half of it; I’m wondering what I can most helpfully recommend to other newcomers to the language/framework.
22 Feb 2007
Andy, a plugin is a world apart from a framework. I’d never recommend people know how to write the OS they are using, either. However, I can’t tell you how many times I’ve had people email or IM me asking me for help on some little glitch, only to find out it is because of some quirk in a plugin they are using. Plugins are not frameworks; by using plugins like black boxes, you are crippling yourself and setting yourself up for problems down the road.
Sarah, the BYO book I reviewed above is more of a beginner’s book than AWDwR; it makes fewer assumptions about the reader’s experience with web development and programming in general. Also, AWDwR attempts to delve into more of the framework; the BYO book doesn’t cover ActionMailer, for instance, or
has_many :through, or REST, or page caching, all of which are more advanced topics. The BYO book really is targetted at helping someone brand new to web development and Ruby to “get their foot in the door.” AWDwR would be a good second book for such people, I think.
22 Feb 2007
Great review. I’d have to agree with you on the plugins. Using plugins (or their equivalent in other frameworks/languages) as black boxes has often left me burned in the past. I have found that as learning tools they have been great! For example, I’ve learned to build effective auth systems by implementing various plugins and dissecting them.
22 Feb 2007
Hi Jamie, In the internet I see two different covers of your book. One with a new railway and the other with an old steam engine. Are there two different books? Or is the content identical?
27 Feb 2007
Alex, it’s not my book, I just reviewed it. I’m not sure what would be up with the two different covers; the cover image I posted here is from the publisher’s website, though.
27 Feb 2007
Thanks for the link, it is a wonderful book and really helps us in getting people started on rails in our company.
14 Mar 2007