A few years ago at Hutchmoot, Pete Peterson said something that has been enriching the leaf-mould of my mind ever since. Quoting Walt Wangerin, Jr., Pete talked about how the Sanskrit word cinoti “makes of the poet ‘a heaper into heaps, and a piler into piles.’”
In that essay, Wangerin goes on to write:
We artists, we writers—we come upon the stuff of our crafty attentions already there. But we find it a mess. Hopeless. A meaningless chaos. Our job is to organize. To order. To heap certain things with certain things over here, and to pile other things over there. To declare associations and differences and relationships. To make of this chaos a cosmos, which we do by translating things into language, and language into character and episode, and episodes into whole stories. —Walt Wangerin, Jr., “Story and History, Shaping the Day”
There is a shelf in my library labeled “Programming and Other Poetry.” On it, T. S. Eliot, Gerard Manley Hopkins, and Anne Bradstreet sit nestled among books on algorithms, data structures, and business analysis.
Every weekday morning, I go to work at a fluorescent-lit office full of standing desks adorned with rubber duckies, computer screens, 3D-printed desk toys, coffee mugs, and printouts of programming memes. (“It was the data,” sobs First World Problems lady, ”Just like always.”)
There, for eight hours, sometimes punctuated by lunch if I remember to eat, I immerse myself in wreaking order from chaos. I shape the vague longings of pharmacists into clearly worded statements of work. I ponder business requirements and conform them by imagination into my software’s existing architecture. And, most glorious of all, I use words to breathe new worlds into being, or to reorganize worlds that have grown chaotic.
Writing poetry is the closest thing I know to writing code. Every word, every line break, and every punctuation mark has enormous significance. Micah Hawkinson
In the beginning, there is a blank screen, ominous and full of promise all at the same time. I know that my first effort will almost certainly be wrong. I will probably even break the rules of the language, causing the compiler to scream errors at me. But I will fix my mistakes until the code compiles. Then I will run it, and find problems, and fix them, and run it again, until I can’t find anything else wrong. Then, I will move on to the next piece of the solution and start the whole excruciating process over again.
Finally, when the code is as done as I know how to make it, I will beautify it. I will remove duplication, make logic more elegant, and straighten out the crooked lines, until it is ready to be reviewed and merged into the trunk of our code-tree. It is a long road to my destination, but I have a general idea of how to get there.
The cursor on the blank screen flashes at me, daring me to type the first word. And with fear and trembling, I do.
Writing poetry is the closest thing I know to writing code. Every word, every line break, and every punctuation mark has enormous significance. Each decision must be carefully considered, weighed, and fixed or thrown away if it is found wanting. In poetry, as in code, large mistakes are irritating, but subtle errors can be disastrous.
I am not the first person to observe these similarities. In The Mythical Man-Month, Frederick P. Brooks, Jr. writes:
The programmer, like the poet, works only slightly removed from pure thought-stuff. He builds his castles in the air, from air, creating by exertion of the imagination. Few media of creation are so flexible, so easy to polish and rework, so readily capable of realizing grand conceptual structures. —Frederick P. Brooks, Jr., The Mythical Man-Month
As beings made in the image of the Great Maker, we delight in shaping the world around us, in forming a cosmos from the chaos.
Sometimes, while I wait for my code to compile, I write poetry on my PC’s other screen. I choose my words carefully, line them up in order, read them aloud, and savor their taste on my tongue. Occasionally, my co-workers give me funny looks and turn their headphones up. After I’ve written a stanza or two, I rethink the lines, revise them, play with them, seeking out lovelier ways to tell a truer tale.
When I increase my automatic test coverage, or rewrite a block of code in half the lines, or rename a cryptic variable to something clearer, I feel the same thrill that I get from writing the perfect final couplet of a sonnet. I am working on this world in my hands, shaping it through wisdom until I can sit back and call it very good. In this, I reflect my Maker.
I’m not really suggesting that code is a sub-genre of poetry, or even that it is equally important. After all, poetry is the pursuit of truth by way of beauty. Computer science is, as Aristotle said of money, “merely useful and for the sake of something else.” In my case, the “something else” is providing for my family, giving to build God’s kingdom, and supporting other sub-creators as much as I can.
But this much is true: Our God-given hunger for a beautiful, well-ordered world touches every area of human endeavor. I’m thankful to have a job where I can serve others by building worlds of pure thought-stuff, even if those worlds are merely useful. And I trust that my code, like my poetry, echoes God’s Word that called His good world out of the formless void.