jargon

Comparison

RefactoringvsRewrite

Refactoring

you changed the shape of the code all afternoon and the tests never went red once.

Changing the internal structure of code without changing its observable behaviour. The behaviour-preserving part is the whole definition, which is why 'refactor' is misused when it means 'rewrite this bit and probably alter what it does'. Being precise matters in planning, because a real refactor is safe enough to interleave with feature work while a behaviour change needs its own testing and its own rollback story.

Full entry →

Rewrite

you decided to start again, and the old system kept receiving feature requests the whole time.

Replacing a system with a new implementation rather than evolving the existing one. It is occasionally correct — when the platform is unsupported, the model is fundamentally wrong, or the thing is small — and it is usually chosen for the wrong reason, which is that reading the old code is unpleasant. The costs that get missed are the undocumented behaviour the old system accumulated and the feature freeze that never actually holds.

Full entry →

Related comparisons