Enter the maze

Programming Wizards

Magician throwing cards: www.istock.com 00008718221

Elite programmers are often called 'wizards'. It turns out that isn't far from the truth!

A magic trick is made of two parts: a secret method and a way of presenting it. Unless both work, the magic trick will fall flat. Software is similar. It also consists of two things. The first is an algorithm: the instructions that when followed by the computer lead to it doing whatever it’s there to do. The second is the human-computer interface: the code that makes it easy to use. It turns out algorithms are just like magic secret methods and interfaces are like the presentation of a trick.

Many magic tricks are 'self-working'. That means they don't involve sleight of hand or hidden mechanisms. As long as you follow the steps the magical effect occurs and your audience is left surprised. But that is what computer scientists mean by an 'algorithm'. Programs are just algorithms written down in a language a computer can follow. Self-working tricks are algorithms for doing magic. In fact the algorithms of some tricks are based on ones actually used in computing applications. For example, there are powerful tricks based on the algorithm used by early computers to search for data.

The whole audience make the same mistake at the same time

Most tricks have an underlying algorithm, but also include steps that rely on some kind of sleight of hand or misdirection. The audience look in the wrong place at the wrong time, or are made to believe something that isn’t true. They don’t see everything, even if everything is there to be seen. The magician engineers the magic ‘system’ so that the whole audience make the same mistake at the same time.

It is of course similarly possible to engineer a computer system so that its users make mistakes too. Unlike a magician programmers don't do it on purpose. Some human errors are not about negligence or stupidity but are about the limitations of our brains and the way we see the world. That is exactly what a magician relies on. Software developers have to do the opposite. They have to design the system so that no one makes mistakes in using them. If they don't take human limitations into account their programs will mislead.

Misdirection, is one way a magician misleads. It relies on the fact that we can only focus our attention on one small area at a time. If it is drawn to one point then we will miss other things. Instead of drawing a person's attention away from things that matter, with software, their attention should be drawn to those critical things. For example, if a nurse mistypes a dose into a machine delivering a drug, then before starting the infusion, you want the nurse's eye drawn back to the screen, not away from it, using the magician's tricks, so they check the dose is as expected.

Both programmers and magicians rely on misdirection

Whether designing an algorithm or an interface, the principles are the same as those behind creating a great magic trick. When programmers are writing new programs they are using the same computational thinking skills as magicians inventing new tricks. Learn to program and you could become a real wizard!

Try a magic trick that relies on misdirection for yourself and see how easily people make mistakes: the Four Aces trick.