Implementation as Interface

With a sufficient number of users of an API,
it does not matter what you promise in the contract,
all observable behaviors of your system
will be depended on by somebody.
 — — 
Hyrum’s Law
Or, to put it differently, “given enough consumers, the interface will eventually exactly match the implementation”.
A quick story here — a developer I know (of eponymous #CowboyDeveloper fame) built out a complicated thing whose main job was to process incoming messages. There was an entire eco-system of queues — queues to handle messages, queues to handle ACKs, queues to deal with transactions, queues to deal with queues, and lord knows what else, but the whole thing was wrapped in a fairly simple interface. As fate would have it, this thing ended up in widespread use, as part of a larger mission-critical system.
If you registered the “lord knows what else” bit above, you probably spotted the problem, that nobody other than the #CowboyDeveloper had any f**king idea what it was doing, or for that matter, how it was doing it.
/via http://geek-and-poke.com
We tried to swap out the internals Ship of Theseus-style, to abject failure — anytime we streamlined a component, or simplified the code-paths, or, heck, even swapped out an entire subsystem of the thing, EVERYTHING crashed and burned.
After much head-banging, we eventually figured out that the mission-critical system the thing was embedded in was dependent on timing quirks in the way the “thing” worked! It turned out that our #CowboyDeveloper had
 1. embedded the thing in the mission-critical system
 2. which had promptly barfed
 3. so the dude kept tweaking the “thing”” till everything stabilized
Step -3- above literally consisted of stuff like “wait XXX milliseconds before each scan of the queue because if you wait longer (or for less time), everything crashes”. And no, there was no documentation to this effect, we had to puzzle it out (•)
So yeah, the interface may be the only thing that other components theoretically use, but it doesn’t matter how decoupled your systems are, and how strong your contracts are — all it takes is one #CowboyDeveloper to get you firmly into Hyrum’s Law territory.
The point behind all this? Be very very careful when you’re designing distributed systems. Or, heck, anything even moderately complex. Hyrum’s law will bite you even if you have the best people, and, frankly, you probably don’t…
(•) Actual quote — “I hand-tuned the code till it was reliable, we won’t need to worry about it any more”

Comments

Popular posts from this blog

Erlang, Binaries, and Garbage Collection (Sigh)

Cannonball Tree!

Visualizing Prime Numbers