on gardening and code

May 23, 2004

Ned Batchelder writes about pulling weeds (via HMK) and I agree wholeheartedly.

Most people don’t like weeding. In a garden on a sunny day with good tools, it can be enjoyable, but planting is really the fun part. The same goes for software. You want to be making new stuff, not maintaining old cruft. With habitual pruning and weeding, you can maintain the code while you are working on the fun stuff.

My garden began with a few seasons of digging dandelions in the company of a three-year-old who was happy enough to dig in the dirt while I dug up the long tap roots. I now garden with a six-year-old who knows that the weeds we don’t dig up today will come back next year with brothers and sisters and nephews and cousins.

The native plants grow well and survive when we go on vacation. I don’t know where pansies come from, but they need an unnatural amount of water (relative to the other plants in my garden). The colors are pretty, but I probably won’t plant them again. In software, some parts of the code seem to need an unnatural amount of maintenance. Andy Hunt and Dave Thomas talk about software as gardening and how when it is difficult to maintain it may be an indicator that the requirements are incorrect. Are you trying to plant an orchid in a desert? Sometimes that feature just doesn’t belong. If it is required, maybe the rest of the ecosystem needs to be developed.