At the Forge - 2010 Book Roundup

Reuven shares his list of favorite Web/database books from the past year.

Hello, book-lovers! If you live in the Northern Hemisphere, you presumably are reading this as the weather is getting colder. But as I write this, Israel (and much of North America and Europe) is “enjoying” rather hot weather, with very high temperatures and no obvious relief in sight. Regardless of whether the temperature is high or low, I'm always game for a new book to teach me about the latest open-source Web-related technologies. Fortunately, a number of good, new books have been published during the past year. This month, I'm taking a break from my usual discussion of the latest open-source Web-related technologies, in favor of a list of some of the more interesting books I've seen this year.

Ruby, Python and Perl

Regular readers of this column already know that for about five years now, my favorite programming language is Ruby. This is due in no small part to Ruby on Rails, the Web framework that has taken the industry by storm, against which all other frameworks seem to be measured. Given Ruby's popularity, it's no surprise that publishers continue to offer a large number of Ruby-related titles. However, many of these books are aimed at more-advanced programmers, often looking to improve their programming techniques and code maintainability.

Two of the more-advanced Ruby books I've seen have almost identical names, and confusingly, both come from the same publisher, Addison-Wesley. Refactoring Ruby by Kevin Rutherford is a combination taxonomy and tutorial, introducing Ruby programmers to common “code smells”, potential problems with code that should be addressed before they get out of hand. Rutherford is the author of one of my favorite tools, Reek, which automatically identifies code smells and, thus, potentially problematic code.

The other book, Refactoring (Ruby Edition), is by Jay Fields, Shane Harvie and Martin Fowler, with Kent Beck. As the title implies, this is a Ruby version of Fowler's classic Refactoring, which introduced the idea to many programmers that it's both possible and good to improve code without changing its functionality. The book includes many examples of how to make your code more readable and emphasizes the use of many small methods rather than a small number of long ones. As I read through this book, I alternated between feeling good about my current techniques and understanding how I might improve my code's maintainability. It's easy to read, with many clear examples, and it's good for intermediate and advanced Ruby programmers.

A hot topic in the Ruby community, and in the programming world in general, is that of automated testing. Two books released in the past year, both from the Pragmatic Programmers, address the issues of testing from different angles. One, Rails Test Prescriptions by Noel Rappin, is a great introduction to all the different ways you can test code in your Rails application, starting with the basics (models and controllers), moving on to mock objects and factories, and finally looking at Cucumber, Webrat and Capybara. If you are interested in the alternative RSpec test framework for Ruby, as well as testing with the scenario-driven Cucumber system, The RSpec Book written by RSpec's current maintainer, David Chelimsky, might be worthwhile reading. It introduces both RSpec and Cucumber as complementary, and it shows how to use the two of them to test your code effectively and easily, both before and as you write it.

Although I do spend most of my time working with Ruby, it's true that I still do use other programming languages on occasion. In particular, I often teach courses in Python programming. To date, I hadn't seen a book that went into many of the more-advanced aspects of Python programming, with a particular emphasis on object-oriented development, automated testing and metaprogramming. However, the book Pro Python, written by Marty Alchin and published by Apress, aims to fill in this gap, and from what I've seen, it does an excellent job. I expect I will recommend this book to students in my advanced Python development classes. Although the book is written for Python 3.x, the author recognizes that much of the Python world still is using the 2.x series, so he includes a large number of sidebars and notes indicating differences between 2.6, 2.7, 3.0 and 3.1 where appropriate.

Finally, I should add that although Perl is no longer the first language for which I reach when writing code, it still occupies a warm spot in my heart. It was, thus, something of a homecoming for me when a client recently requested that I do a project in Perl, and that I use Catalyst as the framework for that project. Perl hackers would describe Catalyst as an excellent MVC Web framework (which Ruby hackers would describe as a Perl knockoff of Rails).

Regardless of your perspective, Catalyst is a good way to write modern Web applications in Perl. And, although there certainly are similarities between Catalyst and Rails, there are enough differences that I needed an introduction to Catalyst to get me up and running relatively quickly. The Definitive Guide to Catalyst, published by Apress and written by Kieren Diment and Matt Trout, was just what I needed. When I had questions about how Catalyst worked, I found myself turning not only to the excellent on-line documentation, but also to this book.