Stop! Rewriting is almost never the answer. More often than not, refactoring is a better bet.
Of course, there are times when a rewrite is worthwhile:
- Switching to a new platform where migration tools don't exist (or can't be written cheaply enough).
- When the application to be rewritten is trivial.
- When the source code for the original application is lost, and recovery is more expensive than rewriting.