A Box, Darkly: Obfuscation, Weird Languages, and Code Aesthetics
Michael Mateas Georgia Institute of Technology College of Computing School of Literature, Communication and Culture
Nick Montfort University of Pennsylvania Department of Computer and Information Science
The standard idea of code aesthetics, when such an idea manifests itself at all, allows for programmers to have elegance and clarity as their standards. This paper explores programming practices in which other values are at work, showing that the aesthetics of code must be enlarged to accommodate them. The two practices considered are obfuscated programming and the creation of “weird languages” for coding. Connections between these two practices, and between these and other mechanical and literary aesthetic traditions, are discussed.
Programmers write code in order to cause the computer to function in desired ways. But modern computer programs are written in a form, usually textual, that is also meant to be manipulable and understandable by human beings. For a programmer to understand what she herself is writing, and to incorporate code that others have written, and to simply learn how to program with greater facility and on a larger, more complex scale, code has been made legible to people. While a computer system may compile or interpret code, it is important to the nature of code that it is interpreted by people as well.
A typical perspective on code would be that clarity and elegance are the only possible values that programmers can have when writing it, although they may succeed to a greater or lesser extent at writing clear and elegant code. But if this were the case, how is it possible to explain the way that people sometimes intentionally obfuscate their code, making its functioning more or less impenetrable, even when there is no commercial or practical reason to do so?1 The existence of obfuscated programming as a software development practice, and as an aesthetic practice, throws a wrench into the simplified theory of coding that would claim that coders must always strive for clarity. An additional complication is seen in programming languages that are themselves designed as jokes or parodies, sometimes called “weird programming languages” or “esoteric programming languages.” Such languages are designed to make legibility of any program difficult. Obfuscated code and weird languages highlight the importance of the human reading of code in software development. If some code is only to be read by a machine, it can be neither obfuscated nor clear: it can only function properly or not.
This paper suggests some ways to enlarge an aesthetics of code to account for the existence of obfuscated programming and “weird languages.” Such consideration shows that a
Sometimes people might undertake to make their computer programs difficult to understand for commercial reasons — to thwart competitors and clients, for instance, and to increase others’ dependence on them. This practice is entirely different from the obfuscated programming discussed in this paper.
previously neglected layer of computing and new media is available for rich aesthetic understanding.
2. READING CODE
Version 2.1 of the online lexical reference system WordNet gives 11 senses for “read,” including “look at, interpret, and say out loud something that is written or printed” and “interpret the significance of, as of palms, tea leaves, intestines, the sky, etc.; also of human behavior.”  This discussion is about a fairly literal application of the most common sense, “interpret something that is written or printed,” although of course code that appears on a screen (rather than being written or printed out) can also be read.
The understanding of behavior is certainly involved in reading code in the primary sense of “read,” however. It is essential to any ordinary human reading of a computer program to develop an understanding of how the computer will behave, and what it will compute, when it runs the code that is being examined. In a popular book on the history of software, one of the developers of FORTRAN is characterized as “an extraordinary programmer who could ‘execute’ a program in his head, as a machine would, and then write error-free code with remarkable frequency.”  Actually, all programmers must do this to some extent, using some internal model of what code will do. Just as understanding what a program does, and why, is critical on a practical level for the programmer, it is important to the aesthetics of code as well. Because code functions, “the aesthetic value of code lies in its execution, not simply its written form. To appreciate it fully we need to 'see' the code to fully grasp what it is we are experiencing and to build an understanding of the code's actions.” 
The analysis of a computer program or system often involves examining how the program behaves and “reading” (in this other sense, “interpreting the significance of”) the intention behind the program, the structure of the program, or the more fundamental causes for the outputs observed. This is very frequently done in reverse-engineering in “black-box” situations, where code and other internals are not available for inspection. A network administrator might also be able to “read” the behavior of a malfunctioning router and figure out the problem without looking at any code. But these types of analysis also apply to systems that are not governed by legible code at all, and are not, by themselves, examples of the phenomenon under consideration, the human reading and interpretation of particular texts, computer programs.
Reading in the main sense is about looking at something abstract. “Reading a photograph” sounds odd, perhaps because the photograph is not printed matter but also because it represents a framed perspective rather directly, with little abstraction. It is much more usual to read a diagram or map, because these are abstract representations. The development of