Hacker News new | ask | show | jobs
by 542458 2170 days ago
I think saying "you should never rewrite code from scratch" is a bit too dogmatic. There's a cost and risk tradeoff. I think people underestimate the cost of a rewrite (Due to ego or NIH or yak shaving), but I don't think it's never the answer.

Sometimes the language is so old it's cripplingly expensive to hire programmers in. Sometimes the code is deeply tied to a hardware architecture that is extinct. Sometimes the legacy code actually is that bad.

For reference, I've done total rewrites on two different small-ish software projects - in both cases because the original author had made design choices that made the whole thing unsustainable in the long run (no blame implied, it's more about shifting goals).

For reference, Twitter has done a total rewrite of their large codebase, and lived to tell the tale.

3 comments

Yeah, it's probably closer to things like fiddling with assembly, manual thread syncing and rolling your own crypto - it's not that you should never do it, but unless you're very, very sure what you're doing and why, it's probably a bad idea.
Indeed. The most successful project I've work in my career was a re-write of a very large internal tool. The choice to "re-write" & re-envision was almost universally regarded as a good choice after the fact. One of the biggest reasons cited was moving to a different tech stack.
I hear you.

But I think that dogmatically saying "You should never rewrite code from scratch" is just useful enough to catch the vast majority of instances when you should not rewrite code from scratch.

I'm willing to be called out for being totally wrong for my dogma in the rare instance that the application should be rewritten from scratch.

Every project I have ever joined on, there has been someone who wants to start fresh. There have been a lot of projects. There was one such instance where it was a good idea.