Book Review: Clean Code: A Handbook Of Agile Software Craftsmanship

Clean code is one of the most important things in a programmer’s work life. Almost every time I have to reuse code that was developed in universities or more generally by non-professional developers, the code is difficult to read and to understand.
After reading this book, I tend to know why it is so and how I can change my ways of coding to produce cleaner code.

Content and opinions

Robert Martin wasn’t the only one to write this book although he wrote most chapters. Clean code is difficult to define, each developer has its own definition, but there is some common ground. This is what Martin tries to retrieve in the different chapters. The first chapters describe the general coding, with meaningful variable or function names, formatting and function length, comments. All this is purely a matter of correctly describing the intent of the code. The chapters that follow have also another aspect on program conception and architecture: structures and classes, error handling, using third party code and even unit tests. This may not seem like clean code related, but in fact it is, as the author takes the point of view of long term clean code. An interesting aspect is also concurrency, with detailed explanation of its general use, the impact on code.

The are several chapters dedicated to refactoring actual code, before a final conclusion chapter. The whole book can be skipped and just this final chapter read, but it may not be a good idea: read the book to have the full explanations, and then refer to this chapter to refresh your memory.

Conclusion

Although I do not apply every piece of advice in my everyday coding, I should do so. Some tips may sound too much, but in fact their existence has a reason (explained in the book, of course). It’s a set of coding rules that should followed as much as possible, even if it costs some time at first. It is a gain in the long term.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.