With legacy code, how do you know when it's best to rewrite over refactoring?
One factor to look at: would it take less time to rewrite than to disect and refactor the code?
Discussed extensively:
http://stackoverflow.com/questions/146124/what-are-the-limitations-of-refactoring
http://stackoverflow.com/questions/35233/rewrite-or-repair
http://stackoverflow.com/questions/21857/when-do-you-know-its-time-to-rewrite-an-application
http://stackoverflow.com/questions/78806/refactor-mercilessly-or-build-one-to-throw-away
I think the question is, how do you tell which would take less time, a complete rewrite or a refactor of existing code.
The answer probably has something to do with a different question: can you, upon glancing down the code, immediately see what chunks can be separated out into usable modules, and upon testing a positive answer by trying a few small cases, did the program break?
If you could not immediately see a way, or the program broke when you tried a few small cases, it was probably badly enough written that it needs a rewrite.