JMU
Refactoring
An Introduction


Prof. David Bernstein
James Madison University

Computer Science Department
bernstdh@jmu.edu


Getting Started
Before Refactoring Can/Should Occur
When is Refactoring Needed?
When is Refactoring Needed? (cont.)
Examples of Refactorings to Improve Clarity
The Refactoring Process
  1. Test the existing code.
  2. Identify a refactoring.
  3. Make a small change that gets the code closer to the desired code.
  4. Run regression tests and debug if necessary.
  5. If the refactoring is not complete, go to step 3.
  6. If the code needs further refactoring, go to step 2.
Other Kinds of Improvements (i.e., Functional Improvements)