Refactor In Very Small Steps

You want to ReFactor code, and you don't want to introduce errors while you're doing it. You also don't want to get lost by doing several things at the same time.

Therefore, refactor in very small steps. Find the smallest useful change you can make. Make it. Then TestEveryRefactoring.

This should save you a lot of debugging time.

Example. Let's say you have this complex method that uses a lot of temporary variables. Using MethodObject, you first create the new object. You compile. You change the original method to use the new object. You compile and test. The new object now has a single complex method called compute(). Using ExtractMethod, you define a new method that does part of compute()'s work. You compile. Now you change compute() to use the new method. You compile and test. And so on.


CategoryRefactoring
EditText of this page (last edited May 20, 2000)
FindPage by browsing or searching

This page mirrored in WikiPagesAboutRefactoring as of July 17, 2004