The Art of Readable Code – a recomendation

The Art of Readable Code (Theory in Practice) , Dustin Boswell, Trevor Foucher

As programmers, we’ve all seen source code that’s so ugly and buggy it makes our brain ache. Over the past five years, authors Dustin Boswell and Trevor Foucher have analyzed hundreds of examples of “bad code” (much of it their own) to determine why they’re bad and how they could be improved. Their conclusion? You need to write code that minimizes the time it would take someone else to understand it—even if that someone else is you.

One of the books I was reading lately to make use the times when I have no energy for something too challenging is “The Art of Readable Code”. I found it at random and got it for my Kindle, which  means I can forget about it for weeks at a time and just pop in whenever I feel like it. As it turns out, this is exactly how the authors intended this book to be read, every chapter is self-contained and highly actionable.

The problem is that --run_locally was named after the circumstance where it was typically used. Instead, a flag name like --extra_logging would be more direct and explicit.

But what if --run_locally needs to do more than just extra logging? For instance, suppose that it needs to set up and use a special local database. Now the name --run_locally seems more tempting because it can control both of these at once.

But using it for that purpose would be picking a name because it’s vague and indirect, which is probably not a good idea. The better solution is to create a second flag named --use_local_database. Even though you have to use two flags now, these flags are much more explicit; they don’t try to smash two orthogonal ideas into one, and they give you the option of using just one and not the other.

That “actionable” part is why I liked this book so much – it enables you to get the benefits of reading the book from day one, or just pick and choose technique  for yourself as you read through. With myriad real life examples, each in relevant context and in one of several common programming languages, the books presents the direct benefits of using its suggested ideas in the project you are working on right now, and with every episode summery these ideas are provided in a simple to remember, simple to use form, making “The Art of Readable Code” a book that will not only save you time from the minute you start reading it, but will make your code a true eye candy, or even a source of inspiration.





Adam Lev-Libfeld

A long distance runner, a software architect, an HPC nerd (order may change).

Latest posts by Adam Lev-Libfeld (see all)


Leave a Reply

Your email address will not be published. Required fields are marked *