Clean Code Book – Chapter 1: Clean Code

Last modified date

Comments: 0

These are some important notes from the clean code book chapter 1.

Most of this chapter was introductions and definitions about what clean code is. Later chapters focus more on how to write clean code.

It is important for programmers to not bend to the will of managers who don’t understand the risk of writing poor quality code. Managers want products built quickly but that will always ultimately lead to a product that might work, but will have poor underlying code that will be impossible to maintain and build upon in the future.

It is the responsibility of the programmer to dictate to manages the schedules and risks of a projects and programmers should be telling managers what to do, not the other way around.

On the topic of clean code, the overriding message from this chapter is that clean code does one thing well. Clean code is focussed, each function class, module is there to provide only one purpose to the code base and remains completely independent to the rest of the code.

In addition code should be highly readable, like well written prose and should be matter of fact and not speculative. This ensures that it is also easier for other people to read the code as well and build upon it.

Writing code is also a craft, it is your craft, so clean code is the outcome of people who care about their craft and paid great attention to the details.

One of the most interesting points made in Chapter 1 of the Clean Code book is that at the beginning of all Javadoc there is the @author field. Programmers are authors, and authors communicate to their readers. So the code that is written by programmers is written to be read.

The Boy Scout Rule is also mentioned in this chapter. The Boy Scouts of America have a simple rule:

Leave the campground cleaner than you found it.

Boy Scouts of America

If everyone checked in code that was slightly cleaner than when they checked it out, it would prevent the degradation of code and code rot.

The clean code book can be found here on Amazon.

Read the summary of the Clean Code Chapter 2 here.


Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment

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