Bad reasons for a rewrite
October 10, 2022Don't rewrite because the code is confusing.
Everyone loves a rewrite.
Or more like, everyone loves the idea of a rewrite.
Especially after joining a new project, it seems. “Man, who wrote this?” “This code is so disorganized.” “You’ll never believe the spaghetti code we’re dealing with!”
Now there are times when rewrites are a good option… perhaps even the only option. But be careful!
Never go into a rewrite because the code “crap”. Or because it’s confusing. These are terrible reasons for a rewrite.
If the code is crap… refactor it to not be crap.
If the code is confusing… learn it (likely by refactoring it). After all, if you don’t understand the code well enough to maintain it, how do you have the confidence to rewrite it?
What's the relationship between TDD and Evolutionary Design?
TDD doesn't give you ED for free, it only makes it easier.
What is refactoring?
As in alegebra, code (re)factoring doesn't change the meaning of an expression, only the representation.
Refactoring for readability
A simple rename can save hours of time in the future.