Clean Code — Chapter 1 Reading Summary

The Importance, What & Practice Boy Scout Rule

Tek Loon
3 min readNov 10, 2021
Photo by Sincerely Media on Unsplash

Introduction

After finishing Clean Code chapter 1, I would summarize this chapter into 3 important sections.

  1. The Importance of Clean Code
  2. What the Heck is Clean Code?
  3. Apply Boy Scout Rule into your programming practice

The Importance of Clean Code

Why Clean Code is important? Programmers who write messy code could still deliver results. For example, we could still have a fully functional and reasonable performant system but with a messy codebase.

So why bother to write clean-code right?

To me, writing clean code is about an act of delayed gratification. You aren’t doing it for now, you do it for the future.

What are the consequences if we don’t write clean code?

The book said that the purpose of writing clean code does not only because of maintainability. It’s also affecting our professional survival.

To be honest, if you would have to deal with a very messy codebase every day. Would you really enjoy your work life? I probably won’t and I will burn out at a certain point and quit. That’s why writing clean code enables us to enjoy our work, enjoy our life, and indirectly contribute to our professional survival duration.

When the messy codebase grows, the developer’s productivity starts to slow down. When this reached the threshold, developers start to complain and request to refactor the project otherwise they can’t continue with the project. The cycle continues and this normally happened between years.

In addition, we spent most of our time in work reading code instead of writing code. That’s why writing clean code is so important.

What the Heck is Clean Code?

Now we realized the importance of clean code, but what is clean code exactly?

To write clean code, we need to know what is clean code.

Let’s take a minute and ask yourself what clean code means to you?

Is Clean code means:

  • Code without any unused code?
  • Code with high-performance?
  • Code with high efficiency?
  • Code that is easy to understand?
  • or all of the above?

It seems like we all have similar doubts and are uncertain about the definition of clean code.

The book has several great authors in the Software Engineering industry explaining what they think clean code is supposed to be. These few points below resonate with me the most:

  • Readability. Clean code is pleasing to read.
  • Maintainability. Clean code is not only pleasing to read, but it also needs to be easy to change.
  • Decisive. Clean code should contain only what is necessary.
  • Expressive. Clean code should be straightforward and easy to understand. A good approach is Meaningful Names which is discussed in Chapter 2.

Of course, there’re also points such as efficiency, tiny abstraction and etc. But the above points resonate with me the most.

Apply Boy Scout Rule into your programming practice

The best quote in this section:

Leave the campground cleaner than you found it. — The Boy Scouts of America

This is such a great reminder for me. To be honest, sometimes I am reluctant to change what is already working unless it is an enhancement. But the above quote serves as a great reminder for me.

If I can just improve 0.1% of the codebase whenever I came across the messy code, the compound effect will kickstart in long term and the project just got better & manageable over time. However, communication is important within the team, communicate well and make sure you don’t just blindly improve the code and break something.

Remember this.

Leave the codebase cleaner than you found it.

Notice

This post is part of the reading summary that I wrote in Gitbook. You could read the Gitbook here.

Feel free to give me any constructive feedback and suggestion in case I am missing out on something truly important from the book.

I hope you enjoy it and thanks for reading.

--

--

Tek Loon

Coder and Writer. If you enjoy my stories— support me by https://www.buymeacoffee.com/tekloon so I can keep writing articles for the community.