WordPress has a slogan that intrigues me because I am both a poet and a web developer. The slogan is: “Code is poetry.” At first, I thought Finally! My two worlds have collided! But, the more I think about it, the less writing code is like writing poetry. Here’s the similarities that I found:
1. A good piece of code is beautiful
As Keats elegantly put, “beauty is truth, truth beauty” and that’s what we find in a good piece of code. Say we want to make an object opaque. We set the opacity, in CSS, to 0.75. The object will be at 75% opacity and look super rad. Lines of code, like lines of poetry, can speak to and interplay with each other. For example, take a look at this CSS code:
Each part of the code is adding to the element. First, the margin of the element is affected. Then the padding inside the element is expanded. The last line adds a background color of light blue. The HEX code for the light blue is also playful, almost spelling out the word “Coffee” which is contrary to its color.
2. Logic in poetry, logic in code
If you can dream – and not make dreams your master;
If you can think – and not make thoughts your aim;
If you can meet with Triumph and Disaster
The “if” statements carry this poem and, in this particular poem, lead down to the end line: “then you’ll be a man, my son!” Progressions in logic and rhetorical devices are common in poetry. They are crucial to most programming language.
1. The emotional quality of poetry
The number one thing most people think of when they think of poetry is the emotional quality to the line, a teenage angst, etc. And true, most poetry tries to connect with the reader on some emotional level. William Wordsworth wrote that good poetry is “the spontaneous overflow of feelings.”
All code is devoid of emotion. The end result may elicit a result from someone experiencing the code executed, but the code itself does not resonate emotionally. Good design relies on a visual result to elicit emotion. The underlying code is barren of emotion.
2. Right brain / left brain
When I write code, it gives the other side of my brain a rest. I enjoy the problem solving that writing code presents and when I write a poem, I usually don’t try to problem-solve the poem. While the idea of right brain / left brain has been debunked (different sections of your brain are being activated during differing activities), the creation of good code uses another part of my brain.
As you can see, it could easily be said that “Code is poetry” as WordPress has, but I would argue that “Poetry is not code.” For more examples on how code is poetry, check out the incredible article by Jay Hoffmann here: http://wpdaily.co/code-poetry/ For more examples of how poetry is not code, right click on your browser window, click “View source” and try to make poetry out of the HTML.