Clean code

Why is clean code so important?

There will be code

Remember that code is really the language in which we ultimately express the requirements. We may create languages that are closer to the requirements. We may create tools that help us parse and assemble those requirements into formal structures. But we will never eliminate necessary precision—so there will always be code.

Bad code that brought the company down

Have you ever worked on a codebase where it felt like "the more code I add, the more complex it gets"?
Adding more and more features, the code got worse and worse until they simply could not manage it any longer. It was the bad code that brought the company down.

We spend most of our time reading code

Programmers think they spend most of their time writing code when, in reality, they spend a lot more time reading and reviewing code, documenting, figuring out what to do and how to do it, debugging, etc.
When we optimize something, we start with what is easy to change, will take less time to modify, and will have the most impact.

Code feeds on our time

Another big misconception is that the code we type is the core value of our product, when in fact, the real value of the product is its' final, working state. The code is just a medium we use to translate an idea into a thing with which we can interact.
With every line of code, we add to an application, we take the risk of adding bugs, doing more testing, and failing. So the code actually feeds on our time.

The Total Cost of Owning a Mess

As the mess builds, the productivity of the team continues to decrease, asymptotically approaching zero.
The more code, the higher complexity. The higher complexity, the more expensive.
Technical debt: it’s the result of prioritizing speedy delivery over perfect code. Read more Technical Dept
The Grand Redesign in the Sky: expend the resources on a whole new redesign of the project.

Shit Rolls Downhill

As developers, we are on the front line. Bad code will just roll downhill and negatively affect every other aspect of the product (Infras team, operation team, ...)

Miss the deadline

We have lots of explanations for it:
  • Change requirements
  • Deadline
  • Not enough experience
  • Attitude
The mess will slow you down instantly, and will force you to miss the deadline. The only way to make the deadline—the only way to go fast—is to keep the code as clean as possible at all times.
If you want to go fast, if you want to get done quickly, if you want your code to be easy to write, make it easy to read.