Weeding the Code

California poppies among a tangle of weeds

In spring time, our yard goes crazy. The grass grows tall and weeds eagerly emerge — the stubborn kind with thick stems that bounce back up when you try to cut them down. I am a reluctant gardener. Even though I value our little patch of green space, I am always toying with the idea of hiring someone to just clean it all up. There are two things that prevent this: being too cheap and impatient to have a yard maintenance crew come out, and the idea that it’s my own yard, goddammit, and so I ought to clean it up myself.

I am always glad when I get out and do the work. It is a solitary, meditative experience. I’ve tried listening to audio books or podcasts while I do it, but the weed-whacker is too loud. So I just go out with my own thoughts.

I have an old push mower that delights passers by, when they see me trying to will it through the thick carpet of bermudagrass that has taken hold in our front lawn. “Man, I used to mow my grandma’s lawn with one of those!” one tells me, chuckling. I like to tell myself that I use the push mower because it gets me some additional exercise, and this is partly true. But the real reason is usually that I didn’t bother to borrow my neighbor’s electric mower.

I discover things when I clean up the yard. Earlier in the season, when it’s still damp from winter rains (presuming it has rained in California), I will find clusters of mushrooms hidden in the tall grass. I pull these up so that my dog will not eat them. As I pull and whack the weeds, bugs and spiders scurry away. They have been making a home here. That’s fine, bugs may need a home somewhere, but I don’t want it to be where we run around and play.

I think a lot when I am doing this gardening, as brute force as it may be. The analogy of working with code becomes apparent. I’m certainly not the first to make the comparison; Hunt and Thomas write in The Pragmatic Programmer that building software is more like gardening than construction. But I feel it, out there in the yard.

It’s the way that just cutting through the brush reveals things, hidden dangers and tangled branches that were somehow a bigger mess than you thought. The way I feel the importance, the necessity, of yanking out plants that have become a blight. The other day I cut back a massively overgrown rosemary bush with a hacksaw and felt a moment of catharsis and clarity; I suddenly had worked out how to refactor a set of classes with better abstraction.

Sure, the models are really good at finding bugs in your code. I liked Nolan Lawson’s recent blog post about using LLMs to write better code more slowly, using their ability to ferret out bugs and triage them. I’ve tried it myself with some success.

Still, I think about going out there in the yard. Taking a quiet afternoon and getting away from distraction, getting my jeans dirty, and cleaning it up myself. Often, I’m not just weeding the yard, I’m weeding my mind. Through the tangle, I can see the whole.