Ward Cunningham on refactoring

This is a great quote about software development from Ward Cunningham in this 2012 Dr. Dobbs article:

“Some people might have used that word (refactoring), but even when I talked about it in an often-quoted paper, I think I called that consolidation, not refactoring. In other words, you figure out what it should have been, and you make it that. Whereas the prevailing wisdom at the time was, ‘If it’s not broke, don’t fix it.’ So the first time you got something working, you quit. That’s not a way to make great code.”

The part I italicized is a great description of refactoring: You figure out what the code should have been, and you make it that. As developers we always try to make code right the first time, but it seems like we always learn more about the project and the relationships between code elements as we go along, and so we do a lot of refactoring, or “housekeeping,” which is another word that Mr. Cunningham uses in that article.