Code Is Not Poetry

Much of the Internet, including these words, “runs on” a piece of software called WordPress. It has become the most popular blogging platform because of smart architecture, passionate contributors, and a healthy bit of good luck. You are likely to know WordPress, and also its slogan “Code is Poetry” might sound familiar.

I write code (I am admittedly bad at it) and I write poetry, so even though my character is not the character of an authority, I am going to say something about this point. For I think it is not the case. Code is not poetry.

Poetry is a shortcut to our shared imagination.

John Keats
John Keats

Here are the first lines of a poem by Keats, one of the most celebrated poetic geniuses of the English language

My heart aches, and a drowsy numbness pains
My sense, as though of hemlock I had drunk,
Or emptied some dull opiate to the drains
One minute past, and Lethe-wards had sunk:
’Tis not through envy of thy happy lot,
But being too happy in thine happiness,?
That thou, light-winged Dryad of the trees,
In some melodious plot
Of beechen green, and shadows numberless,
Singest of summer in full-throated ease.

John Keats, First stanza of “Ode to a Nightingale”, May 1819

Now let’s look at the following short fragment of code:

function gcd(a, b) {
while (b != 0) {
t = b;
b = a mod t;
a = t
}
return a
}

I can think of two possible reasons why we would consider such lines to be poetry.
1) Taken as a whole, it invokes a poetic description of the world. Perhaps. What code does is calculate (in this case, the greatest common divider of two integers). If we read the lines of code aloud, substituting perhaps the variables with numbers, it “come to life”, we can follow how the numbers are manipulated, chopped, combined, and how the algorithm outputs an exact result. In a way, code shows truth in action. This seems very poetic, but let it be reminded that it’s us who add the poetic perspective. In and of itself, there is nothing poetic about Euclid’s algorithm.
2) It uses terms that are themselves poetic. Words like function, return, while, integer, boolean, float, switch, mod, div, constructor, class, array might seem poetic, and they could certainly appear in poetry, but I don’t think they are necessarily poetic. That would be absurd. Perhaps there are people who can express their feelings through code (as robots probably would), but we cannot assume that everybody could. Just like saying, for instance, that everything written in Greek is poetry, it is nonsense to say that “code is poetry”.

These considerations are simplistic, but it shows that we just shouldn’t take these kind of claims seriously. If code is poetry, everything would be, and all would be lost.

Leave a Reply

Your email address will not be published. Required fields are marked *