Refactor to Accommodate Change

Certainly, there are a lot of other techniques for working with legacy code. The basic idea, however, is simply this: clean it up, make it more maintainable and easier to understand, and then retrofit in tests to make it safer to change. Then, and only then, with the safety of unit tests, refactor the code in more significant ways.

I call refactoring a discipline but it still has a long way to go. We need to develop it as a discipline that shows standard ways of transforming code. I would much rather have a methodology that shows me how to safely and repeatedly change code that I could share with other developers than to just have an intuitive feel that I couldn’t express to others on how to go about fixing code, ...