chapter one
1 Refactoring refactoring
This chapter covers:
- Understanding the elements of refactoring
- Incorporating refactoring into your daily work
- The importance of safety for refactoring
- Introducing the overarching example for part 1
It is well-known that high code quality leads to cheaper maintenance, fewer errors, and happier developers. The most common way to get high code quality is through refactoring. However, the way refactoring is usually taught—with code smells and unit testing—imposes an unnecessarily high barrier to entry. I believe that anyone can execute simple refactoring patterns safely, with a little practice.
Figure 1.1. Skills, culture, or tools
In software development, we place problems somewhere on the diagram shown in figure 1.1, indicating a lack of sufficient skills, culture, tools, or a combination of those. Refactoring is a sophisticated endeavor and therefore lies right in the middle. It requires each component: