Coding and elegance

2 Feb 2014

I was very pleased to see that the headline feature in this weekend’s FT Life & Arts section was devoted to the idea of artistic elegance in code – something familiar to those of us who do this for a living, but perhaps not to those who don’t practice.

I’m not sure coding can lay claim to this alone; all engineers I think are looking for elegance in their solutions. But I think the metrics by which elegance is measured is probably hard to comprehend outside each discipline, what is elegant takes domain knowledge to spot that elegance. I imagine most people who see a modern Ducati motorbike don’t see that the engine is actually also a load bearing part of the structure, reducing the need for an explicit frame, saving materials and thus weight and cost, and this is an elegant engineering solution. They just see a motorbike that looks like most others. And if they can’t see the elegance in physical engineering what hope have we that they’ll see it in something as abstract as code? To the lay person one screen of gobbledy gook is as weird looking as another.

A good example from another engineering discipline might be the Millau Viaduct, where the bridge is visually arresting due to the engineering, not because it was engineered to be so. In coding we’re always looking for a solution that functions perfectly, but is at the same time free of fat, complexity, corner cases. Programmers are famously lazy people, and as such we seek elegance as it makes our lives easier in the long term, whilst providing a satisfying intellectual challenge in the short term.

As computing enters more and more walks of life, it pleases me to have an article try and capture some of the more aesthetic sides of what I do for a living. The only time I’ve seen this done better is by the fictional Richard McDuff in Douglas Adam’s “Dirk Gently’s Holistic Detective Agency”, and that was probably only read by the kind of people who understood the argument in the first place. It’d be nice to think articles like this make computing a bit easier to relate to for those who’s lives are ruled by code but don’t understand how it comes to be.