A Box Darkly


This 2005 paper by Michael Mateas and Nick Montfort is a beautiful deconstruction of the idea of software aesthetics. Their goal is to show that the aesthetic component of programming is not exhausted by the idea of “elegance”; they prove it by giving examples of ugly code celebrated for its obscurity, complexity, and general ass-backwardness. They start by unpacking this (comparatively tame) entry from the 1984 Obfuscated C contest, showing how it’s built up from one bizarre abuse of C syntax after another.

int i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\ 
o, world!\n",'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);}

After some further reflections on obfuscated code (particularly how different programming languages generate different aesthetics of obfuscation), they bring in the idea of “double coding,” programs written to have multiple simultaneous meanings in different languages. The second half of the paper then turns to esoteric programming languages (they call them “weird,” which is justifiable, if not quite standard). The tour includes Intercal, Brainfuck, and Shakespeare (plus at least one more Mystery Hunt favorite before ending up at Malbolge, the all-but-unprogrammable programming language.

I could not possibly improve on this passage from their conclusion (emphasis mine):

By commenting on the nature of programming itself, weird languages point the way towards a refined understanding of the nature of everyday coding practice. In their parody aspect, weird languages comment on how different language constructions influence programming style, as well as on the history of programming language design. In their minimalist aspect, weird languages comment on the nature of computation and the vast variety of structures capable of universal computation. In their puzzle aspect, weird languages comment on the inherent cognitive difficulty of constructing effective programs. And in their structured play aspect, weird languages comment on the nature of double-coding, how it is the programs can simultaneously mean something for the machine and for human readers. All of these aspects are seen in everyday programming practice. Programmers are extremely conscious of language style, of coding idioms that not only “get the job done”, but do it in a way that is particularly appropriate for that language. Programmers actively structure the space of computation for solving specific problems, ranging from implementing sub-universal abstractions such as finite-state machines for solving problems such as string searching, up to writing interpreters and compilers for custom languages tailored to specific problem domains, such as Perl for string manipulation. All coding inevitably involves double-coding. “Good” code simultaneously specifies a mechanical process and talks about this mechanical process to a human reader. Finally, the puzzle-like nature of coding manifests not only because of the problem solving necessary to specify processes, but because code must additionally, and simultaneously, double-code, make appropriate use of language styles and idioms, and structure the space of computation. Weird languages thus tease apart phenomena present in all coding activity, phenomena that must be accounted for by any theory of code.languages comment on programming and computation.