Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
When implementing a program feature, the programmers always ask if there is a way of changing the existing program to make adding the feature simple. After they have added a feature, the programmers ask if they now can see how to make the program simpler, while still running all of the tests. This is called refactoring.
Note that this means that sometimes you do more work than absolutely necessary to get a feature running. But in working this way, you ensure that you can add the next feature with a reasonable amount of effort, and the next, and the next. You don't refactor on speculation, though; you refactor when the system asks you to. When the system requires that you duplicate code, it is asking for refactoring.