On order and overhead

My seven year old got a filling today. After Dr. Farmer injected anesthetic into her gums, she said: “Don’t you wish there was no such thing as cavities?”

“Of course, dear, everyone wishes that.” But we humans don’t have complete control over our environment or our bodies. We can’t order bacteria around. We cope with hazards by adding additional systems, like immune systems and dentists.

In programming this happens too. Disks fail, connections drop. Unlike the real world, we control the makeup of our software. We can build awareness and handling of possible failures right into the code. It’s as if we could change the chemical makeup of our teeth. Or, closer to the biological solution, we can develop layers or agents that come behind and clean up, like supervisors in Erlang.

Take database replication – we can encode strict rules into the writes with a two-phase commit, or we can introduce replicators and aim for eventual consistency.

Sometimes it is more effective to clean our teeth than to redesign them.

(As a bonus, my daughter likes her shiny silver filling.)