It's time for a rewrite when:
The cost of rewriting the application + maintaining the rewritten application is less than the cost of maintaining the current system over time.
Some factors that make maintaining the current one more expensive:
- The language is so old you have to pay people that know it a lot of money to program in it (COBOL).
- It has become so complex that the
//Here be dragons.comment is all over your code. - You can't write any other projects and add new value to the company because you're always patching this ugly beast.