At the Forge

2010 Book Roundup

Reuven M. Lerner

Issue #199, November 2010

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.

New Languages

It's nice to work with languages that you already know, but there's a lot to be said for learning and working with new languages as well. Each language teaches you something new and (I would argue) improves your understanding of other languages you already know. So, I was pleased to discover Seven Languages in Seven Weeks by Bruce Tate, published by the Pragmatic Programmers. The book reviews (as you might expect) seven programming languages, each quite different from the others: Ruby, Io, Prolog, Scala, Erlang, Clojure and Haskell.

I had been meaning to learn several of these languages for the last year or two, and although I didn't take seven weeks to read through the book, I did use it as a way to familiarize myself with several of these languages and where they might be useful. (I'm particularly interested in Clojure and Scala, in no small part because of the possibilities for Web development in those languages.) I found the writing to be clear, the examples good, and perhaps most important, the comparisons with other languages were useful. Even if I'm not going to program in Io, for example, it's interesting to see how the data types work and how a prototype-based language operates. As the author himself writes, Io gave him a new perspective on JavaScript, undoubtedly the most popular prototype-based language in use today.

Another popular language, although we might not think of it as such, is SQL, the query language used in all relational database systems. Just as there are books and tutorials about “design patterns”, examples of how you can and should structure your code, a growing number of articles and books talk about “antipatterns”, examples of how you should not structure your code. The book SQL Antipatterns by Bill Karwin, published by the Pragmatic Programmers, introduces a number of ways people should not use SQL and relational databases, and then it shows ways in which database tools can and should be used. I was very happy to see that he recommended against using the “float” type, against searching through textual columns with patterns like '%target%', and against storing multiple values in a single column. I have seen these (and more!) on many projects, and it's nice to have a checklist for what to avoid. I largely disagree with the author's argument in favor of putting images and other large binary objects inside BLOB columns. That said, he made a fairly convincing argument for his case and acknowledged that this is a subject of great controversy. Especially if you're fairly new to database and query design, this book might well come in handy.

World-Wide Web

When Steve Jobs publicly announced that there would be no support for Flash on iPhones and iPads, many people wondered what the alternatives were. Jobs told everyone that HTML5 offers most or all of the same capabilities. My response was, “Hmm, I guess HTML5 is further along than I thought—I'd better check it out.” I've since been reading up on the various parts of the emerging HTML5 standard, and I must admit that it seems very compelling, at least at this stage.

My main source of information is Mark Pilgrim's Dive into HTML5, published both for free on-line and also as a book from O'Reilly. I have long found Pilgrim's writing to be clear and entertaining, and I was not disappointed by his description of HTML5. The Web version of his book has the advantage of being able to demonstrate the features alongside the description, letting you see what your browser can do, with graphical depictions of what other browsers would show instead. If you are a Web developer of any sort, you should read Pilgrim's book, and then bookmark it as a reference to which you will turn many times during the coming years.

Drawing on the deserved praised for Douglas Crockford's JavaScript: The Good Parts, O'Reilly is publishing more books of this type. Crockford's volume is still the biggest bang for the buck, in no small part because he manages to tell you what parts of JavaScript you should avoid. But another book in this series, HTML & CSS: The Good Parts by Ben Henick, is readable, interesting and has given me the confidence to (once again) try to use CSS for something more advanced than basic boxes.

A surprisingly interesting book, also published by O'Reilly, is Web Reputation Systems by Randy Farmer and Bryce Glass. My dissertation software includes a rating system, so I was interested in what these authors had to say on the subject. I didn't expect there would be enough to fill an entire book, but I found that they provided interesting food for thought, as well as practical considerations for the implementation and incorporation of rating systems into a Web site. If you're considering the inclusion of such a rating system into your Web application, this book is worth at least a look.

Podcasts and Screencasts

Screencasts have become an increasingly popular way to deliver tutorials and information. Because everyone can see the speakers' screens, it's possible to follow along as they program, show diagrams and even make mistakes. I've become quite the fan of screencasts and often watch them to better understand a problem or learn a new topic.

Ryan Bates has been producing his excellent, weekly and free “Railscasts” series for several years now. I try to watch every one of them. Particularly as I start to make the transition from Rails 2 to Rails 3, “Railscasts” comes in handy, showing me where I will need to change my code and where I can leave it as is.

The weekly “Rails Envy” podcast is no more, but Gregg Pollack and his colleagues at Envy Labs now are producing a twice-weekly podcast called “Ruby5”, which tries to summarize the latest Ruby and Rails news in less than five minutes. It has more of a newsy feel than “Rails Envy” did, and we no longer get the cheesy (but funny, in my opinion) sound effects and music, but the information is up to date and solid, and it's delivered with a large degree of thought and clarity.

For me, the biggest surprise of the year was my discovery of Bruce Momjian's Webinars (then turned into screencasts/movies) about PostgreSQL. If you work with PostgreSQL, I'm sure you'll get something out of these excellent, carefully written and clearly explained seminars. Momjian works for EnterpriseDB, a PostgreSQL consulting and support company. His screencasts are available free of charge from enterprisedb.com.

Non-Computer Books

I don't spend all of my time reading about computers, although it might seem that way to anyone who sees the stacks of books in my home office. In this space, I mention a few of my favorite non-programming books from the past year, although you'll see that there's still a technical bent to most of them.

Perhaps the most computer-related book in this section is Coders at Work by Peter Siebel, published by Apress. If you read and enjoyed Founders at Work, in which the author interviews the founders of many startups, you likely will enjoy Coders at Work, which interviews many impressive and famous programmers. It's always interesting to hear what some of these programmers have to say and learn from the insights they have gained during their years of software development.

Everyone in my family (including my children) really enjoys cooking. I often have said that one of my reasons for cooking is that it lets me perform science experiments with edible results. For this reason, one of the most important books in our house (often referred to as “The Book”) is the 2nd edition of Harold McGee's On Food and Cooking, a seemingly endless collection of history, facts and interesting tidbits about the science of food and cooking. Well, if McGee's book provides the science, a new book published by O'Reilly, Cooking for Geeks, provides the engineering, offering practical advice, recipes, interviews with cooks and a wealth of techniques you can use right away. (I've already stopped peeling garlic before putting it into the press. Who knew?) If you enjoy cooking, or just want to get into it, I strongly recommend this book.

Another non-computer O'Reilly book is Your Money: The Missing Manual. The Missing Manual series, started by New York Times columnist David Pogue, tries to provide reference guides for users who need a bit of hand-holding, but who aren't going to pay or wait for support. Recently, the Missing Manual series has branched out into non-computer topics, including Your Body (a fascinating introduction to human biology) and the realm of personal finance. Living outside the United States, many aspects of the book weren't relevant to me. However, the general attitude of the book was a welcome one, especially for those of us who aren't as disciplined as we should be when it comes to our money. I wouldn't say that the book changed my life, but it did give me many new ideas about how to get a better handle on my family's finances, which is good for all of us.

Conclusion

Amazon recently announced that it's selling more ebooks than hardcover books, and I can believe it. There is a compelling argument to be made for ebooks, although I prefer the paper versions when I need to concentrate or just for convenience. Regardless of the medium you use to read, let me suggest to readers of this column what I tell my own young children, that the important thing is just to read and keep learning new things all the time. This year's crop of new books, of which I barely scratched the surface here, should provide enough food for thought for at least another year, and probably well beyond that.

Reuven M. Lerner is a longtime Web developer, architect and trainer. He is a PhD candidate in learning sciences at Northwestern University, researching the design and analysis of collaborative on-line communities. Reuven lives with his wife and three children in Modi'in, Israel.