Sunday, March 18, 2012

Review: The Art of Readable Code

This is the review I posted to Amazon on the book The Art of Readable Code:

In short: this book deserves a space on bookshelf and not only for yourself, but to serve as reference when reviewing other's code. And not only reference: this is a short book that you can done in a week or two, like the authors say. I read it cover to cover and finished it within 10 days.

It is straight to the point, has a lot of funny and relevant cartoons, and packs great pieces of advice on how to write readable code. Many of these lessons seem to be common sense, but when I started paying attention to code other engineers developed, I saw how much the lessons taught in this book were not being applied. And I am talking about senior engineers here as well. I even took my own code, which had been checked in a few days earlier, and improved based on these tips.

I believe that many of these tips one can get from reading code written by good developers. I got many of them early in my career from reading the Linux kernel, for instance. But until you put these tips in practice and start seeing your code using these lenses of readability, you will be probably missing out on many of them.

In terms of contents, the authors start with names (incredibly important), but they go all the way to refactoring the code by extracting unrelated subproblems. One are that I liked in particular is how to make your comments useful, describing precisely and in a compact way.

Finally, for those who tend to disregard these tips in favor of "getting things done" and don't care about readability, the authors present an example of a supposedly simple minute/hour counter and show how valuable an organized and readable solution is.
Post a Comment