Saturday, August 23, 2008

Coding as Subcreation

In my last post, I mentioned the connection which both Lewis and Tolkien drew between magic and technology, based on Tolkien's distinction between Enchantment and Magic.

Enchantment produces a Secondary World into which both designer and speculator can enter, to the satisfaction of their senses while they are inside; but in its purity it is artistic in desire and purpose. Magic produces, or pretends to produce, an alteration in the Primary World. It does not matter by whom it is said to be practiced, fay or mortal, it remains distinct from the other two; it is not an art but a technique; its desire is power in this world, domination of things and wills. ("On Fairy Stories", p. 73)

Modern programming languages, I would say, seem to sit on the border between enchantment and magic, desire and control. The world in which programmers live is somewhere in-between the Primary and a Secondary world. On the one hand, writing code does impact on the primary world in ways that The Lord of the Rings does not. Software very nearly always attempts to control something, whether words or messages or advertisements, and in this sense it is more like Magic. The primary goal of software is generally neither beauty nor the arousal of Desire. As any commercial developer can tell you, most software is not all that beautiful and most features, it turns out, are not desired.

That said, there are important ways in which coding is closer to Enchantment than Magic. Like Tolkien's own fantasies, code is a world accessed entirely through language, and like a work of literature, it depends on its reception and use by a third party for its impact. Composing a page in HTML is a little like writing a poem and having the images appear in front of you; but it's even more like writing a poem and having the images appear in front of the poem's reader.

With the example of HTML, another similarity between enchantment and coding arises. While coding is not usually primarily focused on beauty, beauty is nevertheless an important part of a programmer's world. Sometimes this is only in the sense that a functional user interface should have something of elegance and simplicity to it. But sometimes, the code itself (not just the user interface it creates) can achieve an elegance of form which is reminiscent of Heidegger's description of a Greek temple.

The temple's firm towering makes visible the invisible space of air. The steadfastness of the work contrasts with the surge of the surf, and its own repose brings out the raging of the sea. Tree and grass, eagle and bull, snake and cricket first enter into their distinctive shapes and thus come to appear as what they are. ("Poetry, Language, Thought", p. 42).

This may seem an exaggeration, but the comparison is apt in several ways. Good code has good architecture: like a Greek temple, it solves recurring problems in classic ways. But good code not only solves problems, it makes clear for the first time what the problem actually is. When someone asks you to create an application to solve a problem for them, it's normal that they don't really understand what they want. They know that they have a problem, but they can't define it clearly. It's only through the course of building the application, showing it to the person who requested it, receiving feedback, and finally in giving them what they wanted but never quite asked for, that it becomes clear what the problem actually was. Heidegger nods at this process when he says that "τεχνη is a mode of αληθευειν" – technology is a way of being truthful. "It reveals whatever does not bring itself forth and does not yet lie here before us, whatever can look and turn out now one way and now another" (The Question Concerning Technology, p. 13).

I should note, finally, that even Tolkien harbored some hope that the Enchantment which underwrote his subcreational art might eventually find expression in the Primary World. In his delightfully poignant allegorical short story "Leaf by Niggle", he describes what the reader must imagine is Tolkien's own life. Niggle, an artist with troublesome neighbors and unwelcome responsibilities, has a vision of a leaf, and tries to paint it, but soon discovers that this leaf is connected to a tree, and this tree to other trees. Before Niggle has managed to get more than a middling start on his painting, he's called on a journey, and through a sort of purgatory, eventually finds fulfillment in helping his troublesome neighbors. When Niggle is finally released from this purgatorial convalescence, he discovers, to his amazement and delight, that the leaf – and tree – and forest – and mountains – that he had only barely glimpsed in his painting, had achieved a reality of place and beauty beyond his imaginations. "Niggle's Parish," it was eventually called, and as the "Second Voice" in the story remarks, "It is splendid for convalescence; and not only for that, for many it is the best introduction to the Mountains."

I don't know that the beauty or the truth of code will ever be useful, or very useful, as an introduction to the Mountains: its beauty and truth are more akin to physics than to literature. But all grace is gift, and the gifts of grace have been received in stranger ways.

No comments: