Interesting post on code rewriting by the NowJS team. One point of view I have always heard is that a rewrite is amount to admitting technical bankruptcy; even Joel says don’t do it. But the most compelling argument for it is this: Sunk costs and egos get in the the way of good development.
Our job as developers is to provide the best library so that you can write high-performance realtime web applications easily. We could have defended our code just because we worked hard on it for months. But accepting the large upfront cost of a rewrite meant that we would save on development time in the future and also provide a better product to our users.