Skip to content
CONTACT

Hoare's principle

PROGRAMMING AND BUGS

There are two ways of constructing a software design: make it so simple that there are obviously no deficiencies, or so complicated that there are no obvious deficiencies. The first method is far more difficult.

— C. A. R. Hoare, The Emperor's Old Clothes, 1980 Turing Award lecture, published in Communications of the ACM, 1981
VIDEO.EXE16:9

Complexity is an excellent hiding place. In a fifty-line program a bug stands out like a fly on a white tablecloth. In a fifty-thousand-line one it has a house, a family and an allotment.

Hoare reminds us that simplicity isn't laziness: it's the hardest thing to achieve. You have to remove, rethink, throw away code you'd grown fond of. Adding is easy; giving things up takes courage.

I asked a colleague whether his module had any defects. He replied: 'None that you can see.' It was true. You couldn't see anything. Not even the logic. It was a masterpiece of Lombard fog in the form of code, and underneath, in the fog, the bugs were playing bowls.