At the Forge - Book Roundup
Remember the Web? You know, that combination of Internet technologies that will make paper obsolete? Well, it's true that many newspaper and magazine publishers are hurting, and that many people (including me) now read things on-line that we previously read on paper. And, for Web developers in particular, the Web provides a treasure trove of information, ranging from blogs and articles to forums and IRC channels.
Based on the flurry of content that is available on-line, and the reported death of print media, you might think that the number and quality of Web-related books also has declined in recent years. From what I can tell, however, the opposite is true. I continue to see a large number of high-quality books from a number of different publishers, on topics that are relevant and interesting. Even better, I have found many of these books to be useful in my day-to-day work, giving me perspective on technologies I already knew and teaching me many things that I hadn't previously known.
I have been working with Ruby on Rails for several years now and continue to see it as a breath of fresh air. After years in which I had to work directly with a database, writing explicit SQL queries, it's a delight to be able to think about things at the object level, rather than at the row-and-column level. Admittedly, some performance issues exist with Rails, but when you want to create a Web application quickly and easily, nothing else comes close. (Actually, that's not exactly true. If I hadn't been smitten by Rails, I probably would be using Django today. And, there are several Rails-like application frameworks out there, including CakePHP and Catalyst, both of which have their fans.)
The now-classic, standard text for beginning Rails programmers is the second edition of Agile Web Development with Ruby on Rails, written by Dave Thomas and David Heinemeier Hansson, and published by the Pragmatic Programmers (ISBN 978-0977616633). This edition is due to be superseded by a third edition by the time you read this column, so some of my comments might not be relevant anymore. But, I generally have had mixed feelings about the first and second editions of this book. On the one hand, it successfully got me excited about Rails and provided me with a useful introduction back when I was first starting with it. At the same time, I kept searching for an introductory book with a slightly different style that I could recommend to beginning Rails developers.
One particularly strong introductory Rails book is Simply Rails 2, by Patrick Lenz (ISBN 978-0980455205). This book introduces a large number of key Rails features, including the MVC architecture, associations, testing, Ajax, some elements of Prototype and script.aculo.us, and even debugging with tools, such as ruby-debug. Because Lenz aims to cover less ground in his book, he manages to make a more effective tutorial than Agile Web Development with Ruby on Rails. Frequently interspersed code samples, screenshots and diagrams make this a particularly accessible book.
Once you have finished with Simply Rails 2, you will need a reference guide that describes the Rails architecture in greater depth, with a more comprehensive list of features. Obie Fernandez's book, The Rails Way (ISBN 978-0321445612), is an excellent, detailed and thick resource, although I think it mentions (and emphasizes) routes and RESTful architecture a bit early for many newcomers. That's probably fine, given that this book is not meant to be a tutorial, but rather a reference and advanced guide. So, although I strongly recommend this book and use it several times a week as a reference for my own work, it doesn't do the trick as an introduction or tutorial.
Good complements to The Rails Way, and to one another, are three similarly named books from two different publishers: Rails Cookbook, by Rob Orsini (ISBN 978-0596527310); Rails Recipes, by Chad Fowler (ISBN 978-0977616602); and Advanced Rails Recipes, by Mike Clark (ISBN 978-0978739225). Each of these books follows the now-standard format of having many short chapters, each addressing a common problem developers might encounter. Each of these books contains multiple recipes that have given me ideas, and even when I haven't used the recipe directly, I have found them to be useful food for thought. I'm also not sure whether the third book is truly as advanced as its title would indicate.
Finally, the book Deploying Rails Applications, by Ezra Zygmuntowicz, Bruce Tate and Clinton Begin (ISBN 978-0978739201), has a great deal of practical advice about taking a Rails application and making it available to the general public. The authors guide you through using version control (with Subversion), configuring one or more production servers, deploying with Capistrano and identifying bottlenecks. The book assumes you are using MySQL, which means people who use PostgreSQL (like me) can ignore some of the advice. There also is a chapter on Windows deployment that I expect most readers of this column can ignore.
The authors assume you want to deploy your application with a combination of Mongrel (for dynamic, Ruby-generated content) and nginx (for static content), while ignoring such possibilities as Phusion (aka mod_rails), an Apache module that some sites have been using with great success. Then again, Zygmuntowicz is the founder of Engine Yard, a Rails hosting company that has been enjoying great success, so it might be wise to follow his lead. Regardless of the specific implementation choices the authors suggest, this book helps put each aspect of Rails deployment into perspective, and it's good reading for people who plan to make their applications public.