For about as long as computer programming has been going on, so has the quest for better-quality code. Among the early additions to my bookshelf were “Programming Proverbs for FORTRAN Programmers” (1975) and “COBOL with Style” (1976). Both books’ covers promise “Principles of good programming with numerous examples to improve programming style and proficiency” — and looking at them today, for the first time in decades, I see that their advice is still sound.
“The Art of Readable Code” is a new addition to the literature, hot off the press. The subtitle is “Simple and Practical Techniques for Writing Better Code”. The authors’ premise is that readable code is more likely to be comprehensible, less likely to be buggy. My students know that I’m constantly ranting about the importance of writing code that’s clean, readable, maintainable. Although much of this book will be of value only to advanced students or experienced programmers, some of the advice, especially with regards to comments, variable names, and pretty printing, will help even fledgling HTML coders do a better job.
The book is not specific to any one language, having examples in Java, JavaScript, C++, Python, and Ruby, among others. Most of the examples involve object-oriented programming, so old-school programmers may have to stretch their brains a bit more. (That’s okay — it didn’t hurt that much!)
Interesting side-note: a while back, I took a class in Java programming. The professor didn’t know that I teach IT classes. We had a lot of disagreements about coding style and techniques, and since he had the red pen, I acquiesced. If we accept this book as gospel, he was certainly right about many things — but I was right sometimes too.
Any serious programmer should embrace the ideas in this book.
The Art of Readable Code
by Dustin Boswell & Trevor Foucher
O’Reilly, 2011, ISBN 978-0-596-80229-5