Supports Pillars: Technical Excellence Dependencies: Test-Driven Development Definition: Refactoring is the process of improving the design of existing code without changing its externally observable behavior. In order to make big changes to the structure of the code, refactoring uses a quick succession of small, well-known steps that can each be verified as safe (functionally equivalent). Refactoring is most often done in the context of Test-Driven Development/Design where extensive tests and simple design make it easy to refactor safely. Triggers: We may apply a refactoring to:
Forces: forces that increase the cost of changing code: duplication (at either code block or process/algorithm levels) SOLID violations and other code smells forces that decrease the cost of changing the code: refactoring now vs. later low coupling short methods no comments simple design coherent structure small steps automated tests automated refactoring tools in the IDE appropriate use of design patterns Resources: Refactoring / Fowler (and accompanying site http://www.refactoring.com/catalog/index.html) Working Effectively with Legacy Code / Feathers Refactoring to Patterns / Kerievsky |
