Saturday, March 20, 2021

Clean Code by Uncle Bob - Book Review - Must read for Java Programmers

Even though the Clean Code book was released many years ago and there are lots of good reviews already available, I couldn't resist writing my own experience of this great book which every coder should read. I came across this book many years ago, but since then, I have read it multiple times, and I have recommended it to my readers, students, and fellow developers. It is one of those books which make you feel that why didn't come across it earlier, I felt the same when I first learned about this book. The Clean Code is all about writing good quality code, and how do you judge the quality of code? Well, you won't appreciate good until you have seen bad code and that's what this book does.

It first presents a code, which is ugly, hard to read, hard to understand, hard to maintain, and then Uncle Bob goes step by step to refactor that code and converting them into the masterpiece you would be proud of writing.

You will get a taste of how to convert a bad code to good code when you first read his example of an algorithm to generate the first 100 prime numbers. He has explained how to write clean code with the Sieve of Eratosthenes in a very nice way.

Some of you might argue that what is all about the clean code? If a code can function, then it's just enough. Well, it's not. We all think about that when we used to write programs in a computer science lab, our educational projects, and on our semester practical exams but the real world is totally different, here you learn the Art of Writing Clean Code.

One reason for that is because it's not a throwaway code, it will remain longer than you expected. For example, some of the pricing systems in Investment banks are still running on mainframes, which is more than 40 - 50 years old.

If a code isn’t clean, it can bring the company to its knees and reduce its ability to remain competitive by providing cutting-edge solutions. Since a Code needs to be maintained in most of his life-span, it must allow you to maintain and extend, and that's what clean code does.





The Clean Code Book Review

The Clean Code book is well structured and divided into three main parts. The first part talks about principles, patterns, and practices of writing clean code. This is where I first learned about SOLID design principles, and it changed the way I write code.

For example, if I didn't know about the "Open Closed design principle," I wouldn't have understood the full power of Polymorphism and Abstraction ever.

These little principles not only help you to understand fundamentals better but also help you to write better code, which is easier to understand and maintain. The second part is full of real-world case studies of increasing complexity. Each case study is an exercise of turning a bad code into good code, something which easier to read, understand, and maintain.

Btw, the clean code is not just about architecture but also about debugging and performance, a code that is easier to read is also easier to debug and optimize.

The title "Clean Code: A Handbook of Agile Software Craftsmanship" fully justify the content inside the book because coding is no lesser than Craftmanship and his argument that "Even bad code can function. But if the code isn’t clean, it can bring a development organization to its knees" is perfectly valid.

Clean Code by Uncle Bob - Book Review - Must read for Software Engineers


The third part is the most important, a payoff, like a single chapter containing a list of heuristics and code, smells gathered while creating the case studies. You can use this chapter as a knowledge base that describes the way we think when we write, read, and clean code.

The book is full of programming best practices, I mean correctly naming variables, classes, and methods, some of you can find it here as well. It also put a lot of emphasis on unit testing and test-driven development which is one of the attributes of a professional programmer and something which distinguishes them from amateur programmers.

In short, must-read books for the programmer, and after reading this book, you should be able to
  • Tell the difference between good and harmful code.
  • write good code and how to transform bad code into good code
  • Create good names, good functions, good objects, and good classes
  • Format code for maximum readability
  • Implement complete error handling without obscuring code logic
  • Unit test and practice test-driven development
Btw, if you are interested in not just a book but also some online training courses to improve code quality, I suggest you check this awesome Udemy course Clean Code with Java: Learn Simple Design, Refactoring & TDD  by Ranga Karnam. This will teach you how to write better code in Java by following best practices. 



That's all about "Clean Code: A Handbook of Agile Software Craftsmanship," one of the must-read book for any developer, software engineer, project manager, team lead, or systems analyst who want to write better code. So, if you just want to do one thing at this moment, just go and read the Clean Code. It's worth every penny, and every second you spend.


Other Programming resources and Books you may like

Thanks for reading this article so far. If you like my review of Clean Code, a must-read book for software engineers and professional developers then please share it with your friends and colleagues. If you have any questions or feedback then please drop a note.

P. S. - If you are looking for online courses to learn SOLID and design patterns then I also suggest you take a look at the Java Design Patterns and Architecture, a free course on Udemy. It will greatly improve your understanding of writing robust and easy-to-maintain object-oriented code in Java.

No comments :

Post a Comment