Bad reasons for a rewriteDon'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?