Via, Robert X Cringely’s argument against refactoring and Martin Fowler’s response. Here’s how I use refactoring. When I have to go into a program that’s already written, I apply the things that I’ve learned to the code in a manner that generally resembles refactoring. If I can make the code simpler, or make it work better, or make it more like the other code in its family, then I do.

The most important thing that Cringely misses is that refactoring is best practiced in environments where unit tests have been written for all code. If you can unit test your code before and after refactoring to insure that its expected behavior has not been changed during the refactoring process, then you need not worry about lowering the quality through the process. That said, I maintain very few pieces of code that come with comprehensive unit tests.