Possible Duplicate:When is a BIG Rewrite the answer? In Joel Spolsky's famous (or infamous) article Thins You Should Never Do, Part I, he makes the case that doing a rewrite is always a wrong move because:It automatically puts you behind (your competitors/schedule/etc.)The code probably isn't as bad as the programmers believe (anything someone else wrote is always a mess, although some are bigger messes than others - and even then)It's probably easier/quicker/cheaper to fix what's truly wrong with it than to rewrite from scratch.In rewriting from scratch, you are probably going to re-introduce bugs that were fixed in previous versions the original code.Instead, he recommends fixing what's wrong with the code.I assume this is a good summary of his post, and I'll postulate that it is generally true.I'm trying to collect a set of rules/guideline for my team, and one of them (based on Joel's article) isWe dont re-write ... ever! - But we can refactor large portions of the code.  (this exception takes care of ugly/problematic code issues)One question that has cropped up is What about when technology changes and you can no longer get support for older versions?. This is what I think of as the Sisyphean Upgrade path.E.g., I recall when Oracle moved from SQL*Forms 2.x/3.x through to Forms 6i and beyond, Forms that were originality developed in the old .inp format were no longer supported with the current version of Oracle and Oracle Forms. So you had a choice of sticking with an unsupported database with unsupported tools or rewriting the Forms from scratch (or converted with 3rd party tools and then gone over with a fine toothed comb). Which I will call porting, particularly when you are doing a faithful line by line/function by function translation into the new tech and not adding any functionality.The rule then became:We dont re-write ... ever!- But we can refactor large portions of the code.- And we can port the code to a new platform when we *truly* have no other   choice.(and by truly I mean, you can't even buy your way out of the problem for 2x the cost of porting it)Are there any other exceptions that I've missed?
When should you rewrite?
programming practices;refactoring;porting;rewrite