December 5, 2005

DAC 2005: Notes on Mateas and Montfort’s “A Box, Darkly: Obfuscation, Weird Languages, and Code Aesthetics”

by Scott Rettberg · , 12:54 pm

(Update: The full paper “A Box, Darkly: Obfuscation, Weird Languages, and Code Aesthetics” by Michael Mateas and Nick Montfort is online.)

They approach the podium. The screen goes dark, then blue. There is some struggling with cords and configurations. Fingers and bodies struggle with the oppressive apparatus, and conquer it. Their title and names appear on the screen. Then we begin.

Montfort, looking dapper in a trademark wrinkle-free button down blue shirt, black pants, black shoes and wearing a multiplicity of university-issued rings, began the presentation by invoking Donald Knuth’s discussion of reading the program SOAP as like “hearing a symphony.” Montfort then discussed the idea of code as having an aesthetic for human readers. He cited the observation from Maurice Black’s dissertation that while terms like “elegant” and “beautiful” flow freely in discussions of code in computer science, they have been exiled from the vocabulary of literary and cultural theory. This idea of an established notion of coding aesthetic provides a context for the discussion of the “dark side to coding,” obfuscated code, which is “contrived to foil human legibility rather than enhance it.”

Nick then provided a demonstration of several examples of “hello world!” programs — the elementary computer program often used as a first example (so elemental that even I have implemented it, in BASIC in junior high school). The programs Nick demonstrated also all performed the same function of printing “hello world!” to the screen, however the set of instructions they use to do this are particularly tortuous and obfuscated according to different sets of aesthetics. Nick pointed out that all the examples of obfuscated code he provided “explore the play in language, the free space that is available to programmers.”

Nick provided several examples of obfuscated code, all of which produced the same output, each with its own aesthetic or sense of parody. The most compelling example, which Nick explained in some detail, was MeowChow — the appearance of most of the code was like the helixical structure of DNA, in the form of a large piece of ASCII art. Nick walked through the procedure by which that text undergoes a series of transformations. Like all of the examples Nick provided, the compelling thing about MeowChow is that is essentially a work of art that exists not on the surface level of the user’s experience, but instead in the text of the code and in the complexity of the transformations used by the computer to process it.

Mateas, sporting a meticulously sculpted goatee that gives him the look of a somewhat shorter but more procedurally literate latter-day Lenin, then took the stage to explain the concept of weird languages.

Weird languages are not designed for practical use; they are languages which exploit the play possible in language design itself. Mateas provided examples of weird languages based on parody, Turing minimalism, structured play, and puzzle languages, but explained that this list is not meant to be a definitive taxonomy.

Intercal by Don Woods, 1972 — the Ur weird language. Ambition to have a compiler language that has nothing at all in common with any other major languages. Parodying the syntax of four other languages. Explicitly designed to be ugly.

Brainfuck by Urban Muller, 1993 — Canonical minimalist. Turing minimalist. Eliminating all free play. The smallest possible set of instructions that are Turing-complete, that could be used to operate a generalized computer.

Malbolge by Ben Olmstead, 1998 — designed explictly to be difficult to program in. No known working examples of Malbolge programs for two years after it was released. All programs are auto-self-modifying, and include features that make it difficult to program in.

Chef by David Morgan-Mar, 2003 — Programs are also recipes that should not only create valid output, but should also be easy to prepare and delicious. Structured play.

Mateas and Montfort’s presentation was both amusing and served to demonstrate that there is a manipuable layer of aesthetics in programming, both in the way that a given program is coded in a given language and in the design of languages themselves. As the conclusion of their paper states, weird languages and obfuscated programs “invite theorists and critics of new media to look into the dark box of the machine and see how creativity is at work in there, too.”

6 Responses to “DAC 2005: Notes on Mateas and Montfort’s “A Box, Darkly: Obfuscation, Weird Languages, and Code Aesthetics””

  1. josh g. Says:

    And graphical programming languages can have their esoteric versions as well. (I just learned about this one last week, and got a good laugh.)

  2. michael Says:

    Yeah, Piet is nice, follows in the tradition of Befunge, though Befunge is more of a Turing-minimalist and puzzle language, while Piet tends to emphasize structured play.

    A correction: Mateas began the discussion, invoking Knuth and Black. Perhaps Mateas’s Lenin-like beard and Montfort’s uni-modal wardrobe combined into a single obfuscated, and somewhat esoteric, beast.

  3. scott Says:

    Sorry about that, Michael. I can never tell the two of you apart.

  4. Jim Whitehead Says:

    My favorite weird language is Whitespace, a 2003 April Fools language:

    I suppose that if you were to create ascii art using this language, the resulting images would be similar to Malevich’s “White on White” painting of a white square on a white background (though one would perhaps need a special viewer for Whitespace programs that displayed the various kinds of whitespace using subtly different shares of white.

  5. andrew Says:

    How about the Shakespeare Programming Language, created by Karl Hasselström and Jon Åslund, where famous characters are variables, and have to enter and exit the stage to take action.

    If you want to assign a character, let’s say Hamlet, a negative value, you put him and another character on the stage and let that character insult Hamlet. Input and output is done be having someone tell a character to listen their heart and speak their mind. The language contains conditionals, where characters ask each other questions, and jumps, where they decide to go to a specific act or scene. Characters are also stacks that can be pushed and popped.

    A snippet from the canonical (ha) Hello World program, that compiles into ‘x = -64’ :

    Hamlet: You lying stupid fatherless big smelly half-witted coward! You are as stupid as the difference between a handsome rich brave hero and thyself! Speak your mind!

    Sreejith Menon has written a good overview of the language, and includes this simple program to add two values:

    Romeo, A character to store the sum.
    Juliet, An admirer who helps to calculate the sum.

    Act I: A simple play.

    Scene I: Juliet’s conversation with Romeo.

    [Enter Romeo and Juliet]

    Juliet: Listen to your heart!

    Romeo: You are as beautiful as a sweet red rose.
    Listen to your heart.

    Juliet: You are as brave as the sum of me and thyself.
    Open your heart!


  6. nick Says:

    It’s covered in the paper, Andrew. &smiley;

Powered by WordPress