WorryFree Computers   »   [go: up one dir, main page]

We Shouldn’t be Surprised That Code Gets That Way

A lesson from a kitchen cleanup

Ka Wai Cheung
On Building Software

--

This weekend, I reorganized my kitchen.

I don’t love my little kitchen but I spend a lot of time there. It’s cramped. It’s acquired things that I barely ever use. Some tools I use often are stored in inconvenient places.

I know where everything lives even though it might not make sense why things are where they are to someone else. I’m just so accustomed to how it’s all laid out that I barely notice what strange arrangements exist.

But what I do feel is a baseline amount of stress just being in my kitchen. Over time, any place you inhabit and use frequently starts to feel this way.

So, I rearranged.

I moved the toaster oven away from the corner of the kitchen, closer to the front, where it’s closer to the fridge. I gave it a good cleaning too.

I took the tiered fruit basket that sits on the peninsula bar counter, always in the way of the view to our breakfast table, and put it where the toaster was. I also cleaned out the contents—a few things too old, a few other things not fruit at all.

I took out a large glass jar of tea bags that sat inside a lower cabinet and threw out half of the old ones. I combined them with some other tea bags that were shoved into these little plastic drawers we have on the counter and put them all in one Ziploc bag. I tucked the bag neatly back into the plastic drawer. All the bags of tea in one spot now!

At one time, before we had kids and when we had less stuff, that glass container wasn’t buried inside the cabinet, it was a show piece—neatly displayed around a few differently sized glass jars like what a Crate and Barrel ad.

But one day, the showiness wasn’t as important as the space it took up—and besides we don’t drink tea much. So, hastily, I put the jar inside a cabinet. Tea and all. Hidden from view. The near-term mission of gaining extra space on the counter achieved.

We also have this little glass jar (I think it was the container from a fancy yogurt). For a long while, it’s held a small set of scissors, a paperclip, what appears to be a broken hairclip, and my coffee grinder brush. I only ever use the brush. Every day I take it out of the little jar, brush my coffee grinder, and put it back in the little jar, with all the extraneous stuff.

So I recycled the glass jar, put the scissors somewhere else, and threw the hairclip and paperclip away.

I took the brush, the box of coffee filters, and two half-used bags of beans lying on the counter and stored them neatly in the other little plastic drawer—a drawer that had previously been stuffed with random little expired snacks that no one opened. The drawer had devolved into a space to hold items that would eventually get thrown away. That day finally came.

After a couple of hours, the kitchen felt new again. I liked being there again. All because of little changes here and there. Moving things to where they made sense. Getting rid of stuff that I didn’t need. Consolidating similar things into one place.

I didn’t know what would be cleaned up, how things should be reorganized, or what would work best. I made mini-discoveries along the way. I tried a few things that didn’t work right and kept adjusting until it did.

It’s the kind of kitchen cleanup I will probably perform again in a year as things naturally unravel again and the unnoticed stress takes hold again.

Moving some pieces around. Removing pieces that aren’t used. Consolidating similar things. Sound familiar? Refactoring code has that similar enjoyment in the journey and reward at the end. It also can relieve stress that you don’t even notice anymore until you look around for things to clean up.

A kitchen is a known entity—with a feature set that won’t ever change. Even a closed system like this needs a refactoring every so often.

With an open system like a codebase that’s ever-evolving, we shouldn’t be surprised that code gets to the way it is.

No need to blame someone or shake your head. It can’t be any other way.

--

--

Ka Wai Cheung
On Building Software

I write about software, design, fatherhood, and nostalgia usually. Dad to a boy and a girl. Creator of donedone.com. More at kawaicheung.io.