The Dongola Times

(Anachronistic) Dispatches from the Kingdom of Makuria.
03rd of May, 2012

The Heisenberg Uncertainty Principle in Programming

I thought of a diabolical way to undermine everybody’s confidence—as though more of this were necessary at this point in time:

You cannot test a system without reducing the reliability of the system.

So, you write a test case. But that test case is probably buggy, and now you are going to trot about uselessly wondering at which point you were wrong: in writing the test, or in writing the tested?
“I know,” thinks the Fool, “I will write a test for both!”
Now he has three unreliable things. This foolishness happens a lot in many human systems, especially politics. But: Quis custodiet ipsos custodes?

I use statically-typed programming languages, for the most part—and I mean the Hindley-Milner class of type systems—but that is merely a highly-automated case of unit tests (which is why I do use unit tests, even though I have never written even one). Whenever you see programmers in static languages doing something like changing all classes that implement a certain interface—usually to add a method, one that is often as empty of purpose as possible—you are seeing someone who should stop and think: is my code broken, or is the test (the type definition that requires these changes) broken?

You can only measure a system if you also disturb it. You can only test a system if you also introduce more stuff to test. Gödel cracks a joke, and Heisenberg laughs out loud.

Sent in via e-mail.