Simplicity

Simplex sigillum veri

From Dick Pountain, 1998:

Over the years I’ve collected my favourite sayings on the subject of simplicity, a few of which I now propose to share with you. The daddy of them all of course comes from William of Occam (aka Ockham), the 14th century English philosopher: “Entia non sunt multiplicanda praeter necessitatem”. Literally, entities are not to multiplied more than necessary. This principle, known as “Occam’s Razor”, implies that all other things being equal, the explanation that involves inventing the fewest new concepts is always to be preferred. Your hard drive didn’t suffer a head-crash because seven demons put a curse on it; only one demon is required. As a counterbalance there’s Albert Einstein’s dictum “Make it as simple as possible, but not simpler”, a health warning against cutting your own throat with Occam’s Razor – simplification is not the same as skimping.

Antoine de Saint-Exupéry is best known for writing the Little Prince, but he was also a pioneering aviator and aircraft designer. He said “a designer knows that he has arrived at perfection not when there is no longer anything to add, but when there is no longer anything to take away.” This should be tattooed inside the eyelids of the entire Microsoft Office development team. Henry David Thoreau was of the opinion that “our life is frittered away by detail – Simplify, simplify”. Admittedly he lived by a pond, but there is no evidence that he ever ate tofu. Perhaps my favourite of all though is Blaise Pascal’s comment to a correspondent “I have made this letter longer than usual, because I lack the time to make it short.” Anyone who has ever written for a living will appreciate this truth, that writing short pieces is far more demanding than writing long sprawling ones. This column would be three times easier to write if I had three pages (and an agreeable side effect would be that it would pay three times as much).

Professor C.A.R “Tony” Hoare is one of my computing heros. Most famous perhaps for helping define Algol and inventing Quicksort, he also invented the concept of monitors and mutexes back in the 1960’s, then went on to develop the theory of Communicating Sequential Processes (CSP) which promised to take most of the horror out of concurrent programming. Java has just rediscovered mutexes (in the guise of synchronised threads), but perhaps one day, when all the C programmers are locked up and Java programmers have lost their taste for pain, we will see a proper concurrent language based on CSP. Hoare made this mordant comment on the state of the programming art: “there are two ways of constructing a software design: one way is to make it so simple that there are obviously no deficiencies, and the other is to make it so complicated that there are no obvious deficiencies.” Guess which is currently in vogue.

This notion of elegance, in the sense of choosing well, ought to be of paramount importance to programmers. Spotting those actions that are repeated often enough to be worth breaking out into separate routines is a very particular skill, a bit like identifying winning positions in chess. If you can do it well, both your architecture and design will be small and simple. There was a time when I believed no problem in the world could need so much as a megabyte of code, if you factored it properly (and I’m not sure that I don’t still believe it at some level). Nowadays most development tools will make “Hello World!” more than a megabyte. Those damned entia just keep on multiplicanding.