More Programming Pearls - Jon Bentley

My main regret with this book is that I didn't read it earlier. I read Programming Pearls ages ago, but never got around to the sequel. As Programming Pearls covered the core of good coding, the sequel tries to avoid covering the same ground by instead targeting some more peripheral ideas. So, there's discussion of little languages, documentation etc. By having a more eclectic mix of subjects, and ones that aren't covered so heavily in similar books (rather than e.g. plain algorithmic optimisation), I think it's perhaps a more interesting book!

The book is also a strong advocate of the 'Unix style', and in particular several columns demonstrate solutions in Awk, including how Awk makes it very simple to use line-based input data files to e.g. make a little language to run tests cases. Nowadays, of course, you download yourself an industrial-strength unit testing framework to exercise your code, but the idea of lightweight, modular and efficient tools to quickly knock up non-standard things is still good. Or perhaps the modern approach really is to just google for someone else doing what you want and download their code, in almost all cases. Anyway, it's a good sales pitch for Awk, which I must admit I do rather appreciate more since reading Classic Shell Scripting.

In keeping with the Unix style, the book's relatively short and made up of small, independently-readable chapters packed with neat ideas. The structure's not surprising, given the way it is made from a glued together set of CACM articles, but it works extremely well. Recommended.

Posted 2015-01-18.