The Art of Readable Code

Author: Dustin Boswell & Trevor Foucher
Publisher: O'Reilly
Pages: 204
ISBN: 978-0596802295
Aimed at: All programmers
Rating: 5
Pros: Practical, thought-provoking, amusing cartoons
Cons: You may have encountered ideas before
Reviewed by: Mike James


If you only read one book this year - make it this one.

It doesn't contain much that you cannot find elsewhere, and if you are an expert skilled programmer then you probably don't need to read it, but it is nicely explained and it has a modern take on the old advice.

There are many programmers who just learn to code without ever really thinking about what they are doing or how to do it. If you are one of these then The Art of Readable Code might open your eyes to better ways to do things - but only if you are ready for it.

The whole book is about avoiding the situation illustrated in the cartoon in the preface. A completely manic looking programmer works late at night on some code. The second frame shows the same programmer much calmer but clearly dejected two weeks later admitting that he has no idea what the code does or who wrote it. The argument is that programs have to be written to allow programmers to read and understand them in the shortest time possible.




Chapter 1 makes this argument and if you don't see the sense of it the rest of the book will be so much waste paper to you. In fact, if you don't agree with this basic premise, I doubt you would even understand the many cartoons that pepper the book. As long as you do, you'll find the cartoons highly amusing and a key element in the overall readability of the book.

The first part of the book is about "surface level" improvements which means issues like variable naming, line breaks, alignment, comments and so on. It is an easy read, but don't be fooled. Putting some of this advice into practice is hard, but at least you are now aware of the objective.

Part II of the book is about simplifying loops and logic. This covers how to write logic so that its meaning is clear. Using the ternary operator, types of loops, nesting and so on. The chapter on simplifying expressions so that they are understandable is essential reading. Expressions are a part of the code that seems to escape coding rules and any sort of desire to simplify. Indeed there is a school of programming that delights in writing the most complicated expressions possible to shorten the code.

Part III is on what you could call "refactoring", but it's about more than this. There is a chapter on multi-tasking, or more correctly on trying to keep things to one task at a time.

The book closes with some selected topics, including the subject of how to write readable tests and a final example of coding in a project.

Overall this is an easy read with code in a range of languages - C++, Java, JavaScript and so on. The cartoons actually help by making a point in an amusing way and there are lots of pull quotes to sum things up. You probably won't agree with everything that is recommended to make reading code easier - but you don't have to. The book isn't prescriptive. It doesn't insist that there is only one way to do the job. Instead it explains and argues its points and expects you to evaluate the situation to produce an outcome that satisfies you.

The Art of Readable Code isn't a ground breaking book, but it is an easy reminder of how to do things better.
Highly recommended.


SQL Server Advanced Data Types

Author: Peter Carter
Publisher: Apress
Pages: 408
ISBN: 978-1484239001
Print: 1484239008
Kindle: B07FNCN52L
Audience: SQL developers
Rating: 4
Reviewer: Kay Ewbank


SQL Server now comes with support for several new data types including JSON and XML. This book explains what they are and how t [ ... ]

Access 2019 Bible

Author: Michael Alexander and Dick Kusleika
Publisher: Wiley
Pages: 1136
ISBN: 978-1119514756
Print: 1119514754
Kindle: B07J1WJ1ZK
Audience: Access users and developers
Rating: 4.7
Reviewer: Kay Ewbank

This brick of a book has been updated for Access 2019, and while it isn't specifically aimed at deve [ ... ]

More Reviews

Last Updated ( Saturday, 17 March 2012 )