Programming taught me an interesting life lesson: be a stickler for the details. You see, getting the thing to work is only half the battle. You’re not done. Not even close. Yes, make it functional. But then make it readable. Should it also be flexible? Then do so. And certainly make it beautiful.
Be a Stickler
I’m reminded of, years ago, listening to programming conference talks as a junior. In a lecture about clean code, the speaker would emphasize the benefits of “one-liners” - or methods that consist of just one line of code. They’d continue: “And try to optimize for no conditionals.” These words would travel through my ears and instantly reverse course, as if my brain responded with a 404 code. Sorry, not found.
“But how!?” I’d, in frustration, ask my computer screen, while my wife jolted awkwardly toward me.
“Who are you talking to?”
“Nobody, sorry, never-mind.”
It didn’t compute at the time.
If I make the code work, why do I need to refactor and create all of these one-line methods? And what’s so bad about a conditional? “Yeah, yada yada complexity, who cares if it works! This is dumb.”
I'd then congratulate myself for my unearned arrogance.
Nonetheless, as the years have gone by, I’ve of course slowly grown to appreciate the wisdom in such advice. No, these are not blanket requirements. They rarely are. But, as something to aim for, the advice is quite good.
- Multiple pathways increases the likelihood of bugs.
- Polymorphism, instead of conditionals or switch statements, can be an excellent way to reduce complexity.
- Whatever this thing I’m doing over here…give it a name.
- Be a stickler for the details.
That phrase strikes again: “be a stickler for the details.” It slowly grabs you by the collar and refuses to let go. Suddenly, you fast-forward and find yourself obsessively scanning files in search of problems. How might I rewrite this file to be simpler, and more to the point? It’s a mess currently. And that other file over there: I feel actual anxiety every time I'm forced to open it. How do I fix it?
Interestingly - and I expect I’m not alone in this realization - I found that I’ve applied this level of intense analysis to my every-day life. While my youth was quite messy - as my mom would surely testify - these days, I find enjoyment in annoying my family each weekend with requests to optimize our lives or home in some form or another.
“Happy Saturday, folks. Project time!” They’ve learned to dread this word. Project. It's a trigger word for seven-year-olds.
“Uh-oh, dad’s at it again.”
“Hmm,” I think for a moment. “How about each of us grabs a garbage bag, and we don’t stop until we’ve filled them to the brim with Goodwill donations? What do you say? Your bedroom closet is quickly becoming a hazard.”
“NO!” My young daughter recoils with hesitation. “I don’t want to give away my toys!”
“I know, honey, but some of these, you haven’t touched in a year. Twelve months. Come on, that’s my rule. It’s time to pass it on to another kid who will enjoy it. It’s the right thing to do. What do you say?”
She considers my valid argument. “Still no.”
But programming has taught me to never give up. Stick with it, and you’ll eventually work out a solution. We negotiate a compromise and cease-fire, and I’m off to the Goodwill drop-off later that day - genuinely feeling better. It’s as if I’ve completed an ancient ritual to cleanse myself of filth. Okay, I’m being over the top here, but you get the idea…
N + 1
Perhaps this is a western problem, but the longer you live, a privileged but unfortunate and inevitable thing happens: you increase your possession count. It’s a reality; and it’s not necessarily an issue of materialism, I don’t think. It just happens!
Example: I bought my kids two themed rugs - one for each of them - for driving their toy cars around. One rug is themed to the Old West, and the other is full of roads, schools, street signs, fire stations, etc. They’re small and can be neatly stored in the closet. Lovely.
But here’s what always happens: the following holiday, a family member has the same idea. You wake up on December 26th, and now have, not two, but four rugs. Double the possessions, but never double the fun.
Rinse and repeat for countless items, and it's no wonder why so many of our homes become unwieldy. Can you relate? If you have kids, don’t answer: I know you can.
Possessions, big and small, are like weights on your shoulders. Each of them is consecutively stacked in an endless tower of... stuff, like a reverse game of Jenga. Careful, don’t let it fall - or you lose.
If you’re not a stickler for these things, you risk mental collapse from your garage or storage closet; full of junk that hasn’t been touched in years. Worse, the damage is compounding. The more you ignore the garage - or whatever the “garage” is for your life - the harder it is to clean.
It’s not dissimilar from a legacy codebase of 100,000 lines and zero tests. Grab a broom if you want, but it won’t make a dent.
And, so, you just… ignore it. At best, you might pat yourself on the back for considering a garage sale.
“One of these days, I’ll get around to selling this stuff. Might get $25 for ‘em.”
You then close the door, the items now blissfully out of sight, and return to your day. No garage sale this month.
It’s not just the garage, of course. What about those junk drawers in your kitchen? What about your office bookshelf? Why again do I still have programming books from 2004? And what’s the deal with my car trunk? It hasn't been orderly since the day I bought it.
There’s a reason why, while on holiday, checking into a short term rental often feels so refreshing. How nice to open the kitchen cabinet and see four glasses, not forty! Four plates, four bowls, four mugs. That’s all you need.
Why do I have fifty butter knives? Or, perhaps the more important question: why am I unwilling to reduce my fifty butter knives to, say, ten? “Whoa, whoa: easy there, pony. We’re getting just a tad bit crazy here.” Close the silverware drawer and walk away.
We’re the Same
So here’s my guess. You, reader, and I are probably more alike than we are different. We both chose the same career. If nothing else, we know that for certain.
Why? Why was programming a magnet or beacon for you? What specifically was the pull? It surely wasn’t growing up around Hollywood’s condescending representation of the annoying Dorito-fingered hacker in his mom’s basement. So what was it?
Well, it’s tough to say.
Let's try this: give yourself a point for each description that matches your personality.
- You enjoy puzzles and riddles.
- You get a kick out of peeling back the curtain and learning how things work behind the scenes.
- You're a problem solver.
- You view your education as a long-term goal, rather than one that is checked off the moment you graduate high school or college.
- Writing beautiful code is something you - perhaps unnecessarily - obsess over. (Why is that important to you? And when you miss the mark, as we all frequently do, why do you punish yourself?)
Programming is like bootcamp for conscientiousness. If you weren't born with this particular trait - I sure wasn't - you've been given an incredible gift. And if we deny it from overflowing into our every-day lives, we're doing ourselves and our families a gigantic disservice.
Conscientiousness is the personality trait of being careful or diligent. Conscientiousness implies a desire to do a task well, and to take obligations to others seriously. Conscientious people tend to be efficient and organized as opposed to easy-going and disorderly. - Wikipedia
We give up a lot each day, as we stare at computer screens for hours at a time, in search of bugs and inconsistencies. We better get something lasting and real in return for that effort.
So the next time you open your storage closet and gasp, remember that you're a programmer: fixing problems is what we do. And if you don't address it soon, well...don't complain when your life turns into the physical manifestation of that horrible, untested legacy codebase that we all fear. I wouldn't wish that on anybody. 🗑️