The Hidden Assumption That Bit Me

The bug made no sense. The code was right there, obviously correct, and it was still failing. I read it ten times. The problem wasn’t in what the code said. It was in something the code assumed and never stated.

Somewhere upstream, I’d been quietly certain a list was always sorted. It usually was. Then one code path fed it unsorted, and everything downstream that leaned on that invisible assumption fell over. The knowledge that would have saved me — “this must be sorted here” — existed only in my head, months ago, and my head had long since let it go.

That’s when I started treating implicit assumptions as bugs waiting for a date. Every “this is always true” that lives only in your memory is a trap with your name on it, armed for whoever reads the code next — usually a future you who remembers nothing.

So now I pull those assumptions into the open. A type that makes the bad state impossible. A guard clause that fails loudly. An assertion. A name that says what’s true. I’d rather the code refuse to compile than let a silent assumption rot until it surprises someone.

Good code, I’ve come to think, isn’t the clever kind. It’s the honest kind — the code that says out loud what it depends on, so nobody has to guess, and nobody gets bitten by the thing everyone assumed.

– Serguey Asael Shinder

Leave a comment