One Discipline at a Time

As software is developed by making behavioral and structural changes, do not attempt to do both at the same time.  Wear one hat to add new capabilities (including tests) without changing existing code, then wear the other hat to restructure the code without changing behavior.  Build software by swapping hats frequently to develop and test very small capabilities, then refactor to improve the design and the overall quality of the code.

This two-hat approach can be accomplished by a single developer or in pairs.  One of many ways to pair program is for one developer to code the behavioral changes, while the other codes the structural changes.  It also aligns very well with Test-Driven Development.  Make behavioral changes during the Red and Green phases, then make structural changes during the Refactor phase.

Applying this two-hat rule will go a long way in supporting Software Evolution.

*The two-hat metaphor was conceived by Kent Beck.