Clean Code – Book Overview

I purchased a copy of Clean Code, A Handbook of Agile Software Craftsmanship, based on a suggestion from an online post. Someone had mention that this book was their next evolution in team programming. The goal was to take a complex team programming scenario and make it easier as the development effort became larger and more complex. I considered this as my next step or evolution for software development. Make it clean, make it simple, make it readable.

Clean Code is based on the author’s years of experience working with what sounds like larger development efforts. The author provides many practical examples in Java. Even thought the examples are in Java, readers are not required to be fluent in Java. Working knowledge of any similar languages such as C#, C, C++, Rust and even Python should be sufficient to allow the reader to follow the code.

This book focuses on making code easy to read and easy to follow. “Rules” are provided and covers the practical use of variable names, comment usage, code format, dead code, source control, programming constructs and patterns to achieve the book’s goal. With the pages and pages of code example a read would be hard pressed to not understand the provided rules. Many rules are common sense and should be well-known to every developer. For example, variable names should be descriptive and explain exactly what the variable represents. Functions should also explain exactly what the function does and the function should have no side-effects. There are also many that might not be so common for developers which is why you might want to read the book. For example, the author suggest to minimize the user of the switch ( or case) statements.

The author is very clear that the provided rules are his suggestion and may or may not make sense for everyone. Many of these rules seem to make sense when you are working on a large project with many developers or a project that will have a long lifetime or many fixes and updates. Some of the rules or guidance might not fit as well in the smaller, quicker one-off apps commonly created today for businesses.  Smaller, one-off projects certainly will benefit from these rules if you can get them in play, but some of these rules might extend a small project to a larger project so the reader will need to decide where the cut-off is located.

There are many choices of books that cover the softer skills of programming and software development. Many rules or guidelines presented in Clean Code are discussed in other books or posts.  One that I had not seen before was the rule to minimize or eliminate the use of switch statements by using a better object-oriented design and a factory pattern. The author puts forth reasoning behind this rule that makes sense. Of all the rules, guidelines and examples in this book, minimizing switch statements via a design change was the most interesting guideline. Even if the reader is a seasoned developer there are many rules in this book that might help to simplify code and make it more readable.

Given a choice, I would suggest that most of the suggestions in Clean Code should be followed. Sometime reality just is against us. Small projects, one-off projects might benefit from the cleaner code but many companies still have a “Just get it done quickly” mentality.

Have a book that is a must read? Drop me a comment or email and give me a suggestion of books to add to the pile!

Leave a Reply