"Anyway, instead of starting from scratch, I decided it was worth three weeks of my life to completely scrub the code. Rub a dub dub. In the spirit of refactoring, I set out a few rules for this exercise.
1. No New Features, not even small ones, would be added. 2. At any time, with any check in, the code would still work perfectly. 3. All I would do is logical transformations -- the kinds of things that are almost mechanical and which you can convince yourself immediately will not change the behavior of the code.
I went through each source file, one at a time, top to bottom, looking at code, thinking about how it could be better structured, and making simple changes," says Joel Spolsky in this article: