The Day a Bad Name Sent Me the Wrong Way

by Serguey Shinder

I lost most of a day once to a single word. There was a variable in an old service called count, and I reached for it the way you reach for anything with an obvious name, assuming it meant what it said. It didn’t. Somewhere in the history of that code, count had quietly come to mean the number of failed attempts, not the number of items. The name promised one thing and the value delivered another, and I trusted the name.

For hours I chased a bug that made no sense, because my mental model was built on a lie the code had told me at a glance. Every time I read that line, the name reassured me that this part was fine, so I looked everywhere else. The actual problem was sitting in plain sight, wearing a label that pointed the wrong way.

When I finally traced it, I wasn’t angry at whoever wrote it. I’d done the same thing plenty of times myself. You name something in a hurry, its meaning drifts as the code evolves, and you never go back to rename it because renaming feels like busywork next to shipping features. The cost of that skipped rename doesn’t land on you. It lands on the next person, usually months later, usually under pressure.

That day changed how I think about names. A name isn’t a label you stick on for your own convenience while you write. It’s a claim you make to every future reader about what this thing is. When the claim is wrong, it’s worse than no name at all, because a blank tells you to go look, while a wrong name tells you to stop looking. It actively steers people away from the truth.

Now, when I notice a name that no longer matches its meaning, I fix it right then, even if it feels like a detour. It takes a minute. The alternative is someone, someday, losing an afternoon exactly the way I did, trusting a word that had quietly stopped being true. The kindest thing you can do for a future reader is make sure the names never lie to them.

– Serguey Asael Shinder

Leave a comment