Clean Code: Chapter 1

Posted by Andy Huggins on January 22, 2016

The first chapter of Clean Code serves as an introduction. Describes the purpose behind the book and where some of the ideas to come came from.

I really liked the comparison made to martial arts masters...that they don't adhere strictly to the teachings they have learned, but master them and adapt them. Often these masters develop their own styles and have followers of their teachings.

Note: You should find many masters.

Other interesting points in this chapter are some of the quotes about "what is clean code." And it seems that clean code is elegant, simple, small, consistent.

Note: The boy scout rule.

Code should be cleaner when you check it in, than when you check it out.

This is good, if everyone on a team is making small improvements to a code base over time, the code base is constantly getting better. This eliminates big refactoring efforts, or at least minimizes them.

Note: There is a cost to owning a mess.

I think this is the main reason I want to read this book. Bad code will turn a project into a huge mess, it would take a huge effort to undo all the bad bits. The bigger the mess comes, the slower a team makes progress and ships features. So take the time to write clean code, push back on managers/project owners and don't make a mess to ship a feature. In the long run it's going to cost more and make your coding miserable.