Software Development

Code is NOT poetry, it is just code

One can read in the footer of WordPress.org:

Code is Poetry.

This is quite a bold statement and whoever believes in that slogan, he would be made to think that some kind of extraordinary portion of code must reside in the WordPress repositories.

I took the time to look at a random “quote” of the WordPress poem, i.e. a single line of code:

$mode = ( empty( $_REQUEST['mode'] ) ) ? 'list' : $_REQUEST['mode']; // – WordPress.org

If William Shakespeare would have become a coder, he might have written some documentation like this:

We know what we are, but know not what we may be. – Shakespeare

I love Shakespeare for his ability to create emotions, dreams, visions and even imaginary problems by using the right words at the right time. The common programmer, on the other hand, tries to solve a specific problem, and to do this by using as little expressions as possible. We consider code “elegant” when it’s done like that, and when you can easily read and maintain it. With all my love to Shakespeare, I definitely cannot say I can understand him without any problems. I often have to read his texts multiple times.

Here are some more observations:

  • Programmers shouldn’t use the 32,000 words Shakespeare used [1], and they shouldn’t even dare to try to include the other 35,000 words Shakespeare knew, but haven’t felt the need to use.
  • Programmers shouldn’t try to create emotions in their audience. If your colleague got emotional about your code, you most likely have messed something up.
  • Programmers don’t need to write code that sounds nice when you read it loud.
  • Programming is about solving a problem in time and with-in budget. Most poems don’t have a budget, and never solve their problems (See: Edgar Allen Poe, but at least it looks like he wasn’t suffering too much from his problems).
  • Programmers need to write code which can be maintained from others. Some poets would throw an (empty) bottle of wine after you if you would try to “maintain” their work.
  • Programmers shouldn’t care about philosophical problems. Poets are allowed and asked to do exactly that.
  • Programmers need to express something as straight as possible. Many good poems are a matter of interpretation.

While we are at interpretation: poetic interpretation is also very different to how the PHP interpreter for example does his job. Interpretation in poetry is based on your own mind, your own thinking and your own beliefs. Try to analyse this very good poem of William Blake:

Tyger! Tyger! burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?

You can read one analysis here.

On the other hand, interpret this:

prnt_r)('Hello World!');

Sure, sure, you can interpret the programmer is suffering from dyslexia, didn’t test his code or his keyboard was broken. But aside from that, there is nothing more in this line of code.

If this code would work, it is has only a single thing to tell: print a message to the screen. Why? No idea. Read the specs for a detailed and accurate interpretation, or ask your customer to interpret it for you. There is nothing else to find in this line of code. If there is… we usually consider it a bug.

Code is code, but definitely not poetry. It’s also not music. Nor is it painting. It’s code. At best, you could say it has something to do with math. But code and poems have different goals.

But why should one call his code poetry? Honestly, coding actually has a creative aspect: you have a problem, and you need to craft something which solves it just using your mind and a limited set of vocabulary. This isn’t the work of many. Some people say “everybody can code”, but that isn’t true. This is a very specific way to think and it is ignorant to say everybody is able to do that.

If a person would try and fail, this phrase would mean: “everybody except you can code”. It sounds as the person would not be clever enough. Saying things like that would mean we would ignore the fact that people think different, and some people have more physical competence and some others can think in functions and objects.

For example, I am not exactly athletic and I am also not good with statistics. Still people consider me a good programmer, but well, I fail miserably with other things.

Being able to code and craft things by mind allows some people to think they are somehow special; that their power to express commands in clever way is art, or in the case of WordPress: “poetry”.

If somebody in my team would be that proud of their code, all alarm triggers would be called. Would this person be actually able to accept improvements from colleagues? Or would he act like E. A. Poe and throw a wine bottle?

Is the “coder-artist” able to improve his piece of code if he believes this is art? Can he actually write code which solves the problem, or does he need to find the “golden way”? That is the way which is the most likely best solution for a musical problem, as my Jazz friend told me when he explained how he composes music.

As coders, we don’t always need the golden way. Developers have a constraint which is usually missing in art: time. My Jazz friend works for 20 years on his first album. It’s ok in art, he just needs to earn money a different way. But let your customer know a Shop-feature will take 20 years until you find the best code for solving the problem.

Time changes things. It changes how we think. It changes our tools. It changes our needs.

When Blake describes the Tyger, he described the Tyger in one moment of his time. Maybe some kind of period. But there is no need to write a Tyger 2.0. Blake wrote the Tyger, and when he finished, he finished. The Tyger was there, and will not change.

Our software will change. We will, and should, change. For that reason we cannot consider code as art, because it doesn’t survive time in any case. We can call ourselves skillful. But seriously, would you call yourself a fantastic developer? There are quite a couple of problems which comes withthat, as I wrote in “The Zen Programmer”.

Why should you call your code “art” or “poetry”? It must change over time. And this is the only art to master as a developer: to accept that things change, and to adopt these changes without being attached to them.

[1]: http://kottke.org/10/04/how-many-words-did-shakespeare-know[Go back]

zen-programmer
The Zen Programmer

This book will teach you that there are more than just emails, phone calls, and urgent issues. What Zen teachers told us hundreds of years ago is still true today: we can say “No” and have our lives in our own hands. Zen is not only for famous corporate leaders like Steve Jobs. It is for you. It is not for weekends. You can practice Zen at any time, even right now, this second.

Programmers are wanted people. But a lot of us are caught up in social networks, phone calls, and people who just get on our nerves. We believe we need to take every job we can get just because somebody told us we will end up poor and alone if we don’t. By the end of the day we don’t achieve our goals. We try to relax on weekends, but our phones ring with something urgent. In the end we are lost in chaos, day after day, and it’s almost impossible to find our way out.

This book will teach you there are more than just emails, phone calls, and urgent issues. What Zen teachers told us hundreds of years ago is still true today: we can say “No” and we have our lives in our own hands. Zen is not only for famous corporate leaders like Steve Jobs. It is for you. It is not for weekends. You can practice Zen at any time, even now, right this second.

Christian Grobmeier

Christian is a passionated software developer, architect and trainer. He is a member and VP of the Apache Software Foundation, working on projects like Struts, log4j and others. He founded Time & Bill and constantly tries out new ideas.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Rudy Vissers
Rudy Vissers
10 years ago

The ego we put in programming and in life is a big problem. A huge problem. Most of the time, most of the people criticize the work of the others. Programmers are no exception. It is tough to be a programmer for these reasons. Please dump the ego into the trash and be a good person and a good programmer. My fellow programmers : If the code you read is not at the desired quality level please be gentle and give a chance. A chance to the other person to learn. If the code you read is better than what… Read more »

Glenn Zucman
8 years ago

Hello Christian! Nice observations. I think you’re probably right about this. In fact, for a time I used to wonder what “code is poetry” even meant. Nonetheless, I *love* that WordPress uses the footer “Code is Poetry.” To take your Shakespeare analogy, we wouldn’t say that the letters in his sentences are poetry: here’s a B, a K, an A, a few E’s and some other letters by Shakespeare – poetry? Yet that alphabet Shakespeare used, while not poetry, with his vision, gave rise to sentences that were poetry. Perhaps “code” is not poetry, but can give rise to things… Read more »

Back to top button