19 December 2014

Clean Code: A Handbook of Agile Software Craftsmanship

Overview

I’m serious about programming and actively looking for ways to become a better programmer.

I can safely say that this book made me a better programmer and this is just the beginning.

Content

The book covers a wide range of topics, from the things that are downright often overlooked like the way you name things to when and what to comment and making a strong case that most of the time, commenting is a failure to express yourself in code when you should just be writing self-documenting code that reads like a story written in domain specific terms.

The author demonstrates a lot what he thinks constitutes bad code, you may recognize some of the things you do but it’s comforting that he also provides you with the remedies for your ills.

Clean Code also makes you think about how to organize your components, this is useful for writing larger programs, what constitutes a function, how big a class should be, etc.

Classic principles of good object oriented programming are showcased not in an abstract ideals but demonstrated with clear examples.

Many of those principles illustrated in the book are things you would seldom think about until it has been shown to you. For example, mixing different levels of abstraction, it’s part of our nature, of how we speak but it’s far from ideal when organizing logical concept in a program.

You will also learn about ways to handle errors more nicely, what you should do with exceptions, how to handle them elegantly and when you should actually throw one instead of relying on error codes or null return values to indicate success or failure of an operational procedure.

The book also opened my eyes as to why I should get into TDD (Test Driven Development), this is the next thing I’ll be adding to my toolbox. I feel ashamed that I have not taken more interest in TDD so far.

The author also discusses larger aspects of the system itself and the challenges that come with concurrent programming.

A strong aspect is that you get to see the code from the standpoint of a maintainer, which is often overlooked and seldom taught when you’re reading online tutorials that are hacked away for the purpose of demonstrating a single principle.

You get to see the iterative process of making code cleaner. Sometimes, the chapters are long since the task isn’t easy, there’s a lot of back and forth and fiddling around until you get things right just like real world coding but these chapters are worth sticking through until the end.

The book feels like it’s taking part in the modern programming world we see today, like you can apply the suggestions right away and see instant benefits that would make all of your code better.

The chapter about code smells and heuristic is a nice way to summarize the whole book, it keeps things fresh and can be used a quick reference to go back to every once in a while.

What I got out of it

I wish I had found this book earlier. I feel this is a game changer and it’s probably one of the best investment I have made so far.

The examples are all in Java which was a nice addition since I was mainly coding in that particular language at the time I was reading the book.

It has a very practical standpoint feel to it, not only to you get to see code from real software that is in use by a lot of people, you get to see the code pulled apart and refactored in a much better manner. To be honest, my own code is often more terrible than the version he was starting out with, so it’s a big step to see what can be done even with what’s already considered good code.

The author isn’t pretentious about his craft, he makes a good judgement call that peer review is an accepted process in just about any profession and software development shouldn’t be an exception in that regard, there is no need to get defensive about a part of the codebase since in the end, we can all benefit from this.

I have learned to take pride in my code and the work I produce, to be more meticulous if not pedantic about small details that make all the difference.

My ego is not attached to a particular judgement call but it’s nice knowing that I can attempt to make my life easier for myself and others since I’m involved in open source.

Another thing that really caught onto me is that software development is a never ending process. It doesn’t matter how good you think your code is, it can still be improved.

I now try to leave the place cleaner everywhere I visit, every line I touch, there’s often something that can be made.

Verdict

I can barely wait to read this book again in a few months or I’ll be reading the sequel The Clean Coder: A Code of Conduct for Professional Programmers which expands even more on the same topics.



blog comments powered by Disqus