9 Love deleting code
This chapter covers:
- Understanding how code slows down development.
- Setting limits to prevent accidental waste.
- Handling transitions with the strangler fig pattern.
- Minimizing waste with the spike and stabilize pattern.
- Deleting anything that does not pull its weight.
Our systems are useful due to the functionality they provide. The functionality comes from code, therefore it is easy to think that code is implicitly valuable. This is not the case code is a liability. It is a necessary evil we have to live with to get functionality.
Another reason that we tend to feel code is valuable, is that it is expensive to produce. It requires skilled workers to spend lots of time, and caffeine. Attributing value to something because we have spent time or effort on it is called the sunk cost fallacy. Value never comes from investment alone, but from the outcome of the investment. This is crucial to understand when working with code since we have to continually put effort into maintaining the code no matter if it is valuable or not.
Every programmer has tried getting bored with a manual task and thinking “I can automate this.” In many cases, this is indeed why we became programmers. However, we have also tried getting distracted with the automation code so much that it steals focus from the original problem, and ended up spending more time automating it than it would have taken to solve the problem manually.