Explaining the Joy of Refactoring (to the non-developer)

I thought of the above sketch when I recently was explaining why refactoring can be joyous for a developer.

A common workflow pattern is to make something work, however you can. Once you have it working, you clean up your code (refactor), such that the external behavior/functionality is unchanged, but the internal code design and organization is refined and improved. (This should be done in small doses; I would not recommend building an entire application and then trying to clean up its codebase.)

You start with a dilapidated mess (a shack), held together with duct tape, paper clips and whatever you can find. And through disciplined refactoring, you have an elegant, organized and manageable codebase. The transformation is very rewarding and can make a developer happy and proud of their work.

And as noted in the sketch, you should refactor with an automated test suite, so you can verify everything still works. Otherwise a light switch in one room might control the lights (or worse) in another room.