Refactoring to add features
One common reason to refactor is to add features that are infeasible to implement with the current design. There are two ways to go about this. We'll call the first way the cowboy approach. With the cowboy approach, you just start implementing the new feature and refactor the existing application as needed while you are developing the feature. When you are done implementing the feature, you stop the refactoring.
In the best-case scenario, the cowboy approach saves time. It can also result in the least refactoring changes needed since you only refactor as much as you need to in order to implement the feature you are adding. However, it may result in a partially implemented refactoring, if a full refactoring was not needed to implement the new feature. For the optimistic programmer, the cowboy approach fits better with their natural desire to just get stuff done. It's easy to understand why it is a fairly common approach. Proponents of the cowboy...