Wednesday, August 09, 2006

The Compost Heap theory of development

I've read about the 'Broken Window' theory of software development. Can we combine that with Code Smells and change the name of the theory to the "Compost Heap" Theory?

The image that comes to mind is a line of apprentice coders each with a basket of code snippets. Think grass clippings. Each one doesn't look that bad and smells like a freshly mowed lawn. As they arrive at the head of the line, they dump their snippets on a pile they all call "The App". After all the apprentices have emptied their baskets, 'The App' is covered and declared finished. After rain, heat, and much neglect, the neighbors start wondering what is producing that noxious odor. "The App" has become a compost heap. Imagine all the code bugs that thrive in that environment. I'd go on but that story is for another time.

So, the next time you come across a bad smell in your app consider whether your code is still pristine like you remember when you laid down the first few lines or is it a decomposing heap of trimmings. When you mow a lawn, the trimmings can be helpful, but only if they are spread out evenly. You can put the clippings in a big pile, forget about it, leave it at the mercy of the elements but what you can't do is plead innocence or even ignorance when the odor starts to make your eyes water. That smell you are trying to disown is the smell of code rotting its way into becoming code compost. Maybe not today, maybe not tomorrow, or even the next day, but sooner or later someone will have to work with the remnants. They'll ask themselves, "Who wrote this mess and what were they thinking?"

Don't let this happen to you. Clean up those code smells while they are small so it will be more like cleaning up after a puppy who is still young enough to be cute. A chore but one you don't mind doing. If you wait, it will get worse, much more like cleaning up after an overweight, incontinent great dane with bowel issues. High in volume and grossness, low in fun.
Delicious Bookmark this on Delicious

No comments:

Post a Comment

I reserve the right to delete inappropriate comments at my discretion