Check Your Work: Ensuring Your Refactoring Doesn't Introduce Bugs
Code refactoring, as defined by Wikipedia, is “the process of restructuring existing computer code — changing the factoring — without changing its external behavior.” As such, refactored code should introduce no behavior changes. Otherwise, you're not refactoring. You're refactoring and doing something else.