Among the Many Hardest Problems in Computer Science Are Such Things As... #
There’s a saying that the two hardest problems in computer science are caching, naming things, and off-by-one errors.
I think there’s just one hard problem: asynchronously shared state. The others are all instances of it.
Race conditions can only happen when processing happens in multiple places, and they become even more complicated when information is updated by multiple actors and stored in multiple places.
You read a thing from disk, do some stuff to it, write back the result. Except, while you’re doing stuff to the information, some other process reads the same file, does some different stuff to it, and writes its result back. Whoever takes the longest wins, the other’s write is gone.
Where this is more complicated is when the processing is done in human brains, which are notoriously hard to observe, operate in massively parallel fashion, and have extremely distributed and unreliable data storage capabilities.
What do we call this thing? Is it a cache, or a copy? A read-through cache? How often should it be purged? If it’s a copy, is it authoritative? When does it get synced back? The problem is not just that words have meaning, but that they have so many meanings.
A word like “specification” can mean “hard and fast set of rules which explicitly limit the scope of work” to one person, and “the beginning of a conversation which points at the intent of a feature” to someone else. They’re probably going to have some unproductive arguments about whether a thing “satisfies the spec” or not.
And that’s just when we’re talking about simple things like programming. Start getting into conflict or culture or strategy, and holy moly, it’s so much harder.
It’s tempting to say that the solution is “more communication”, but more bad communication can make the situation worse, and even good communication has a cost. “So write it down!” I say to myself in my internal argument, wherein I attempt to reconcile the state I share among the many processes across my brain. Ok, but write what down? Where? How often do you read it back again? Does anyone know where it’s written? Is it authoritative or suggestive? How does one edit it when the situation changes?
Turns out hard things are hard. My past self often assumed that something would not be so hard, and my current self now has to reconcile the new experience of hardness with the cached value of expected ease.
Shared state. It’s one hell of a fucker. The only easy thing is solipsism, but then it’s hard to get much done on your own, isn’t it?