How to Refactor


  • Write tests that will verify the behaviour (or at least compare the new behavior to the old behavior)
  • Make a small change.
  • Run the tests.