A traditional sculptor works with wood or stone striving to release the art inside the medium. It takes great skill and experience to mold such an unforgiving medium into something of beauty; something that anyone, even those of us who cannot sculpt, can appreciate.
Not all art is immediately appreciable by the artistically uneducated – many (myself included) struggle to see the beauty in particular forms of art. One should, however, appreciate that some can see the beauty, expression and skill within forms of art that others cannot.
There is one field which is rarely singled out for its intrinsic beauty. Primarily because it requires an uncommon skill, and without that skill one is unable to perceive any of that beauty at all. It is ironic then that this uncommon field, with all its hidden beauty, does itself produce beauty that can be admired by the unskilled. Much like a master writer will craft a sentence of great beauty which itself describes a scene of beauty.
The field that I allude to is of course programming, and in particular, console game programming (I use the term ‘console’ loosely here to mean any form of fixed hardware, whether it is an iPhone, a C64, a PlayStation 3 or anything in between). Programmers reading this article will undoubtedly have seen code which they consider beautiful or more likely, will have written code that they themselves perceive as being beautiful. What programmer hasn’t sat back after coding up a new system, and thought “Hmm, that’s pretty nice.”
It just feels good.
So what is beautiful code? What makes code art?
As with all art, the answer is subjective. One man’s masterpiece of meta-templates is another’s pit of recursive despair. One woman’s inner loop of perfectly balanced stall free assembly is another’s indecipherable method of maintenance hell.
Beautiful code is elegant.

gracefully concise and succinct. It does much without seeming to – effortless. There are often many solutions to a mathematical problem, but the most elegant one will often be the one that does it in the simplest way with the fewest steps. Note that the quest for that simple solution may be long and arduous, but once seen you exclaim
“Oh, of course!”
Beauty in code spills from that same font.
Beautiful code works with its medium.

Computer hardware is designed with a use in mind – each system will have its strengths and weaknesses and beautiful code works well with that hardware, with that medium, making the most of its strengths, compensating for its weaknesses. It works with the grain. Consider if you will, code running on a multicore system; minimal locking, no stalling, all cores running at maximum capacity.
A thing of rare beauty indeed.
Beautiful code educates.

code itself which is beautiful – no more than the individual brush strokes in a painting are beautiful. The art, the beauty is in the talent that places those many strokes in just the right places in just the right way with just the right colour. True beauty in code can rarely be appreciated at a glance – study and comprehension are required. And study followed by comprehension is learning.
Beautiful code shows us how it should be done; it gives us something to aspire to.
Beauty in code is something to strive for. It is why we love programming; it’s why we dream it, why we neglect our families for it, why we chose this career. But all too often the realities of deadlines, the limitations of the codebase we work within or the fact that it just needs to bloody well work now keeps us from dedicating that little extra time to produce that perfect, beautiful code.
I posit that we as programmers must pursue beauty in our craft, at least occasionally.
At worst it feeds our egos, but at best, it soothes our industry-soiled souls.
Seven Degrees of Freedom. Some even have code in them.