LJ Archive

At the Forge

2009 Book Roundup

Reuven M. Lerner

Issue #188, December 2009

A look at the publications Reuven recommends on Ruby, Rails, JavaScript, Git, Web development and more.

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.

Ruby and Rails

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.

If you're looking for information about the Ruby language, rather than the Rails framework, two new books have come out in the past year, both of which address not only the current 1.8.x series of Ruby, but also the 1.9.x series. These books have different purposes and styles, and they complement each other in many ways. The Ruby Programming Language co-authored by Java/JavaScript book-veteran David Flanagan and Ruby creator Yukihiro “Matz” Matsumoto (O'Reilly, ISBN 978-0-596-51617-8) is an attempt to document, specifically and carefully, the language's behavior. If you are an experienced Ruby programmer, you probably will want this book on hand in order to explain how the language works.

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.

Git Books

Software developers have been using version-control systems for some time. But Git, a distributed version-control system developed by Linus Torvalds, has taken much of the open-source world by storm. For me, the killer feature in Git is its ridiculously simple (and fast) branching and merging. I fall into the category of CVS and Subversion users who have worked with those tools for years, dreading any branching or merging operation that I would have to perform, because it was so painful and time consuming. Git has totally changed that for me, altering the way I develop software.

Numerous Web sites exist for Git users, such as “Git ready” (www.gitready.com) and the Git community book (book.git-scm.com), which offer useful information. But for a complete introduction to Git, you might want to consider one of three books on the subject. The first book that came out, Pragmatic Version Control Using Git by Travis Swicegood (Pragmatic Programmers, ISBN 978-1-93435-615-9), is a good introduction to Git and covers the basics nicely.

However, I felt that this book was lacking some depth and was happy to read Version Control with Git by Jon Loeliger (O'Reilly, ISBN 978-0-596-52012-0) and Pro Git by Scott Chacon (Apress, ISBN 978-1-4302-1833-3). Chacon is well known in the Git community as one of the founders of GitHub and as a screencaster, author and speaker about Git. Chacon convinced Apress to put the book on-line for free (progit.org/book), so you can take a look for yourself. I have found that the Loeliger and Chacon books complement each other, and I've been reading them in parallel, learning from both. You can't go wrong with either one of them.

Web Development and Administration

No matter what technologies your Web site uses, certain issues will crop up. For example, you will have to map out a database and server architecture, ensure that your server's performance is being monitored, and set your URLs and content to reflect best SEO (search engine optimization) practices. It is unlikely that one person on a Web site will need to tackle such a wide variety of problems alone, but if you are a freelance developer, knowing about different tools can be quite helpful and makes you even more valuable to your clients.

Website Optimization by Andrew B. King (O'Reilly, ISBN 978-0-596-51508-9) is a good introduction to the subject of optimizing your site in a number of ways, both for SEO and for speed. Generally, I've been quite skeptical of SEO in the past, thinking (somewhat naively) that with well-written content, Google and other search engines will find you and mark you as relevant. It turns out that well-written content is necessary but insufficient. This book shows what you can do to improve in that arena. To be honest, I have read the SEO portions of this book much more thoroughly than the performance-related optimization portions, some of which I have seen elsewhere.

A well-known business mantra says, “If you can't measure it, you can't improve it.” For this reason, getting a handle on how your Web site performs is a crucial task if you are to understand where and how you can improve it. The book Complete Web Monitoring by Alistair Croll and Sean Power (O'Reilly, ISBN 978-0-596-15513-1) is the most comprehensive list of Web monitoring tools and techniques I have seen to date, looking at every type of monitoring I can think of and then some. It describes how to monitor your site's network connectivity, performance, conversion rates and usability, recommending a mixture of built-in, open-source and commercial tools. It even describes ways in which you can use on-line communities and social networks to monitor reactions to your site, so that the analysis you get is not just a bunch of statistics.

JavaScript continues to occupy center stage in the Web development world. If you aren't yet using a JavaScript framework, by all means, you should start! Frameworks (such as Prototype/Scriptaculous, jQuery, YUI and Dojo) allow you to ignore most of the differences between browsers and provide a huge amount of support for the type of development that you likely want to do. I typically prefer to use jQuery and enjoyed the introductory Learning jQuery by Jonathan Chaffer and Karl Swedberg (Packt Publishing, ISBN 978-1-847192-50-9) as a good introduction to that framework.

Many serious developers now are working on JavaScript in various ways, and JSMag is a new for-pay, PDF publication that aims to give such developers serious articles (www.jsmag.com). JSMag reminds me of other language-specific magazines I have seen over the years, with very high-quality content that addresses topics developers need to deal with. It tries to be framework-neutral, meaning you are as likely to read an article about YUI or jQuery as Ext or Dojo, so if you are interested only in jQuery, you might be slightly disappointed. That said, a majority of the articles are about using the JavaScript language, rather than any one particular framework, which means that no matter what you're using, you will probably get something out of JSMag.

Finally, two well-known figures in the Ruby community, Amy Hoy and Thomas Fuchs (the latter of whom is the author of the Scriptaculous visualization framework that works with Prototype) have published an on-line PDF book called JavaScript Rocks!, available for purchase and download from jsrocks.com. If you are familiar with Hoy's writing, you won't be surprised that this book is an easy read, with a terrific sense of humor and high-quality technical content, addressing everything from reducing JavaScript code size to improving the perceived (not actual!) performance of your application's user interface. The book comes with a copy of the terrific “DOM Monster” tool for optimizing the number and type of DOM elements on a page and for an instant analysis of your page.

Conclusion

This article presents just a small sample of the books I've enjoyed this past year. Authors and publishers continue to release new, good books that are not only useful, but also interesting to read. It's rare for me to read a technical book and not be able to use at least something from it within a few days of reading it. The books I've mentioned here stand out from the crowd because they have provided me with a particularly large helping of food for thought. I look forward to this-coming year's helping of books and to the interesting things that I will learn from them as well.

Reuven M. Lerner, a longtime Web/database developer and consultant, is a PhD candidate in learning sciences at Northwestern University, studying on-line learning communities. He recently returned (with his wife and three children) to their home in Modi'in, Israel, after four years in the Chicago area.

LJ Archive