At the Forge - 2009 Book Roundup
As I write these words, the global economy has been in a recession for more than a year, bringing with it untold financial ruin for a large number of businesses, organizations and individuals. Book and magazine publishers have not emerged unscathed, with many downsizing or otherwise trying to figure out how to profit (or survive) in the Internet era.
But despite the current situation, publishers continue to produce a large number of books, many of which have to do with Web- and Internet-related technologies. If you are a Web developer, you are fortunate to live in an era when high-quality, open-source software is available, Web development frameworks have become popular and easy to use, and there are dozens of blogs on any given open-source technology. Quaint as it might seem, printed books are tremendously useful resources that you can and should try to use to your advantage. Blogs can be excellent, but I still enjoy reading a well-written book that walks me through numerous examples of a new technology or concept.
This month, I'm taking a break from my normal coding examples in order to share some of the books I have looked through and enjoyed during the past year. Most of these books are actually new, but some of them might be just new to me or of new importance to me. There is definitely some bias in favor of the technologies I typically use—Linux, Ruby, PostgreSQL and Git—but I try to remain up to date on a variety of technologies and subjects, and the list of books reflects those interests as well.
Anyone who reads this column knows I am one of the many Web developers who loves to work with Ruby on Rails. Rails has been my preferred development framework for several years, and I continue to be impressed by the number of conveniences that it includes. Rails took off because it was easy to get started with it, as David Heinemeier Hansson demonstrated in his initial “blog” screencasts several years ago. But as Rails has grown in popularity, the needs of the sites that use it also have grown, either in functionality or scalability. Dealing with those issues—preferably before they cause trouble for your site—has become an important topic for Rails developers.
The best book I've seen on the subject is Enterprise Rails by Dan Chak (O'Reilly, ISBN 978-0-596-51520-1). One of the reasons I like this book so much is that it focuses on aspects of Web development that most Rails books either ignore or relegate to the sidelines. For example, the first chapter walks you through the creation of a Rails plugin, which Chak argues is a good way to organize your code for easier maintenance. Whether this actually is a good idea can be the subject of discussion and debate, but it is a rare Rails book that discusses the creation of plugins at all, to say nothing of addressing them as organizational tools. Chapter after chapter in this book is similarly interesting and includes informative discussions of database normal forms, SOA, caching, inheritance and the use of constraints and triggers within the database to enforce data integrity.
A book that covers more conventional ground, but one that is certainly quite useful, is Advanced Rails by Brad Ediger (O'Reilly, ISBN 978-0-596-51032-9). Advanced Rails covers many of the topics a developer needs to consider when deploying an application and when considering security and scalability issues. The book covers a great many topics, and my only complaint is that it tries to cover so much, it loses some of the depth I might have wanted. At the same time, the book is full of references to gems, plugins and Web sites that cover the information in greater depth (and with more working code) than any book could reasonably be expected to include.
The Well-Grounded Rubyist by David Black (Manning, ISBN 978-1-933988-65-8) is a much friendlier book, and it is a tutorial of sorts—not just on the Ruby language, but also in the Ruby way of thinking. A number of Ruby's constructs can be confusing for many programmers, and Black's book steps through them with numerous, well-documented examples. Black also provides a number of tips and explanations about things that aren't always obvious, such as the difference between singleton method definitions styles, built-in callbacks and the various forms of eval.
I also thoroughly enjoyed Metaprogramming Ruby by Paolo Perrotta (Pragmatic Programmers, ISBN 978-1-934356-47-0). It is easy to get started programming with Ruby, but the real power (as with Lisp) is not just with existing Ruby constructs, but the fact that you can modify the language to suit your needs. Metaprogramming, as this technique is called, lets you modify objects and classes in a variety of ways to turn your application into a language for solving your specific problems. Metaprogramming is a bit hard to grasp by its very nature, and it isn't necessarily obvious how to go about using it, or why it might be necessary. Perrotta's book offers a great deal of well-written detail on both fronts, showing you how to use metaprogramming techniques and suggesting when they might be appropriate or useful.
Finally, I should mention Mike Gunderloy's self-published on-line PDF book Rails Rescue Handbook, which you can get from www.railsrescuebook.com. Gunderloy is an active Rails developer, author and community member, and he wrote a book that describes what you should do when you are asked to work on a Rails project that is not working. This book is full of practical advice on how to attack a problematic Web site—from examining the existing codes, to looking for database indexing issues, to the use of metric_fu, to external monitoring with tools from New Relic or FiveRuns. A list of what functionality was deprecated in each version of Rails (going back to 1.0) is handy for those of us who often work on multiple projects simultaneously and might not remember what changed between Rails 2.1 and 2.2, for example. I didn't find any hidden tricks or clever hacks in this book, but that's just fine. The back-to-basics approach is thorough, well written and describes how every Rails project can and should look over time, even if it didn't start off following best practices.