On reading other people's code
Theo M. · Dec 19
There's a kind of premature optimization that comes from imagining a future team. "What if someone needs to swap this out?" Often, no one does.
When a system surprises me, my first instinct used to be to fix the surprise. Now my first instinct is to figure out which mental model of mine was wrong, and update that.
The fastest debugging trick I've learned is to write out, in one sentence, what the system is supposed to be doing. Half the time I notice the bug while writing the sentence.
Most retry logic I've removed turned out to be hiding a real bug. The retries made the failure invisible, and the bug compounded for months in the background.
Caches solve a problem and create three new ones: invalidation, observability, and the slow drift between what the cache thinks is true and what the source thinks is true.
← back to index