A gift for the programmer who has everything? The Art of Readable Code – #programming #bookreview

The Art of Readable Code: Simple and Practical Techniques for Writing Better Code
By Dustin Boswell and Trevor Foucher
(O’Reilly, paperback, list price $34.99; Kindle edition, list price, $27.99)

The software world is full of bad code.

Code that was badly written; code that has been reworked — badly — by dozens of undisciplined programmers; code written in haste to patch or hide a problem; code written without comments that can help you decipher what the previous programmer was thinking — or not thinking; code written by people like me, who didn’t know much at all about programming but had to produce some emergency code anyway, because the real programmers were away on vacation.

The Art of Readable Code could be a very useful book to give the programmer in your life — whether he or she is new to computer programming or an open-minded mid-career professional looking to make some improvements in how they work.

The book focuses on “basic principles and practical techniques” that programmers can apply each time they begin a new coding project or find themselves patching an old one.

The authors present what they call their “Fundamental Theorem of Readability.” In their view: “Code should be written to minimize the time it would take for someone else to understand it.”

For example, “smaller” may not always be better. A one-line expression may be more understandable to other programmers if it is broken into two lines of code.

The 190-page book illustrates its concepts with examples of code from several different programming languages, including C++, Python, JavaScript, and Java. The authors add: “We’ve avoided any advanced language features, so even if you don’t know all these languages, it should still be easy to follow along. (In our experience, the concepts of readability are mostly language-independent, anyhow.)”

The Art of Readable Code has 15 chapters and an appendix and is structured in four parts:

  • Part 1: Surface Level  Improvements – (Naming, commenting and aesthetics that can be applied to every line of code)
  • Part 2: Simplifying Loops and Logic – (Refining loops, logic, and variables so they are easier to understand)
  • Part 3: Reorganizing Your Code – (Higher-level ways to organize large blocks of code and go after problems at the function level)
  • Part 4: Selected Topics – (Applying “easy to understand” to software testing and to a larger data structure coding example)

The authors state: “It’s a valuable skill to be able to explain an idea ‘in plain English….The same skill should be used when ‘presenting’ code to your reader. We take the view that source code is the primary way to explain what a program is doing. So the code should be written ‘in plain English.'”

The book itself is smoothly written and nicely illustrated, not only with cartoons but with some very clear code examples that can be quickly applied.

Si Dunn

Author

  • Si Dunn is a novelist, screenwriter, photojournalist, and book reviewer. His published books include: DARK SIGNALS, a Vietnam War memoir; ERWIN'S LAW, a private-detective novel; and JUMP, a novella about a combat veteran suffering from PTSD and alienation while trying to work for newspapers as a journalist. Several of his feature screenplays recently were under option to movie producers. He spent nearly 15 years working as a technical writer and software tester in the telecommunications industry. His current programming interests include Go, JavaScript, Python, R, Angular, and other languages and frameworks. He is a U.S. Navy veteran and a graduate of the University of North Texas.

Leave a Reply

%d bloggers like this: