Quantum mechanics in software testing

November 25, 2005

...

The other day, a colleague of mine and I discussed our test environment. We concluded that neither
of us had used it for a while and were hence uncertain of its state. Then, I came to think of Schrödinger’s cat, the thought experiment introduced by physicist Erwin Schrödinger in which a cat is placed in a sealed box together with a container of poison and a radioactive substance. A radioactive decay would make the poison escape from the container and kill the cat. However, exactly when the decay will occur is not predicable by quantum physics, only a probability of the occurence may be given. So, given that the state of the cat, dead or alive, cannot be observed without opening the box, its state is uncertain.

According to quantum mechanics, an unobserved nucleus is said to be in a superpositioned state,
both decayed and undecayed. Only when it is observed it seizes to be superpositioned.

Now, it is quite funny to make an analogy to this regarding software development. Unless you test
(observe) your system, it is in a superpositioned state: it both works and doesn’t work. The only
way to make it work, is to test it.

Using this analogy we will arrive at the agile software development mantra of test early, test often.
For instance, using continuous integration with unit testing and automatic acceptance testing, your
system will be in a well-defined state at (almost) all times.


Profile picture

Written by Vidar Kongsli who is a software professional living in Oslo, Norway. Works as a consultant, system architect and developer at Bredvid. You should follow him on Twitter