I’ve spent a year reading Clean Code: A Handbook of Agile Software Craftsmanship. That’s not to say I’ve been reading it once a week or had so little time I only managed to read a single book. Instead, I’ve been slowly making my way through it – sometimes only reading a single page at a time. It has made me a better coder and I’m certain I’ll be reading it again.
The premise is: bad code can operate, but only clean code will work long-term. As code develops and matures, effort must be made to clean and improve it. If your code starts out ugly (or becomes ugly over time), things will inevitably fall apart. Bad code requires too much effort and too many resources to maintain. Businesses and organizations can be weighed down or destroyed by bad code.
This text is easy to work through because the majority is broken into small nuggets of wisdom. It’s quite possible to read the book a couple pages at a time. There’s far too many to list, but I’ll mention just a few of the topics that are explored in detail:
- Think hard about how you name objects and functions
- Careful separation of error handling and application logic can provide the best of both without reducing code readability
- Clean unit tests are just as important (or more so) than clean code
- A well-designed system architecture will allow you to start small and expand functionality without significant growing pains
I have noticed a consistent improvement in the way I approach coding. Spacing the book out through the year kept it fresh in my mind. In no way am I a full-time coder, so it’s more difficult for me to build good coding habits. I’ll be continuing to review the material throughout 2014. I’m also looking forward to reading the “sequel”:
It looks like this text addresses us as programmers. We need to improve ourselves, as well as our code!