Refactoring
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:
improve readability of the code
reduce the cost of changing the code
improve performance
prepare for a specific future change
understand the design/document our new understanding
Forces:
forces that increase the cost of changing code:
duplication (at either code block or process/algorithm levels)
SOLID violations and other code smells
low coupling
short methods
no comments
simple design
coherent structure
forces that decrease the cost of changing the code:
refactoring now vs. later
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
http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod
http://www.thehackerchickblog.com/2008/05/solid-code-with-emergent-design-part-1.html
http://blog.fohjin.com/blog/2009/2/26/Software_Development_is_not_a_Jenga_game
http://www.hanselminutes.com/default.aspx?showID=163
http://www.hanselminutes.com/default.aspx?showID=168
http://blog.energizedwork.com/2010/02/inevitable-and-avoidable-rework_8291.html