Why programming is like writing poetry -- and vice versa

I am somewhat unusual in having a degree not only in CS & Maths, but also in Poetry Studies.

Yet there's more in common between poetry and programming than practitioners from either side usually recognise.

For example:

I'm wrestling with some problem. I'm not completely sure how to characterise it, or what the solution is. I might have a good first-order guess at how to tackle it, or I might not. Part of the function of writing is to firm up this first-order idea of what the right way is.

I open an editor partially to let my mind run cerebral digits around the edges of the problem. I open it partially for the pleasure of writing, of crafting something that might work, that might be the best I've done yet.

While I write, I think precisely and painstakingly about the power of words I use, and the higher-level constructions. There are many consequences to the words and the forms we choose: some obvious, some very much less so. I think hard about how each word relates to the previous and the next. There are words that seem innocuous but govern a whole stanza, and words whose formal weight would seem to guarantee them relevance, but are ultimately forgettable.

Finally, a first draft. It almost certainly won't work. Standing back a moment, casting a mature eye on this brittle reflection of art in mental space, one starts to see the flaws. Now, this approach over here: too dogmatic, naive in its assumptions. It needs to be weakened to survive. These lines here: well-intentioned, but ultimately superficial. And this stanza leading to the climax: too complicated, reaching for the stars when some strong gutter-work would suffice.

So I clench and spread my fingers and set to: removing here, reinforcing over there, refining my underlying conception with experience. I often don't fully know what I intended until I've finished.

But when I am finished, and I scan the results and lean back with a surprised smile: oh, what a feeling. From mind-stuff as pure as anything of my mind can be, I have assembled a striking and resilient statement: a collection of words in the right order, and with just the right effect. Beautiful, and I did it. I linger for a moment in that place where everyone lingers when they think their art is complete.

Then someone leans over my shoulder, reads, and says "But what about..." -- and I sigh. The work to do again.

--

I don't know if that describes any other person's mental experiences when writing software, or indeed sonnets. (I hope not, actually, in the sense that I believe that I am not a very effective constructor of either, and I would like to believe my colleagues more effective than I am.) Yet the thing that strikes me is how completely applicable to both practices the above text is. There are not many things that have that level of congruence.

I find it continually surprising that despite a modern Internet essentially built on video, underneath all of that are words that still have power, still have relevance, and still have constructions which those who care can read and say, yes, that is beautiful. That is right.

Remember this when you think a codebase less than a work of art, or a poem less precise.

Comments

Popular posts from this blog

The Murphy-Beyer Effect

On-call is broken: Kahneman & Tversky told me so