Menu Search
Jump to the content X X
SmashingConf London Avatar

We use ad-blockers as well, you know. We gotta keep those servers running though. Did you know that we publish useful books and run friendly conferences — crafted for pros like yourself? E.g. our upcoming SmashingConf London, dedicated to all things web performance.

The Poetics Of Coding

There is little doubt that WordPress is one of the most popular blogging and content management platforms out there today. This is not an article about WordPress, though, but rather a more general musing on one of its thought-provoking taglines: “Code Is Poetry.”

That’s an interesting metaphor. I’ve written about the relationship between these coding languages and proper human language (specifically, English). As someone who graduated from university with a degree in English Literature and came to Web design in a roundabout way, this kind of thinking has always interested me. [Links checked March/30/2017]

Further Reading on SmashingMag: Link

As has this apparent connection between code and poetry. What does the metaphor mean? I took some time to really think about this relationship and discovered that the people at WordPress got it right (again). Code really is similar to poetry!

A Superficial Similarity Link

To start off, code and poetry have a somewhat obvious and entirely superficial similarity, and we may as well begin there. Here is a poem I wrote a few years ago:

A man in a suit,
standing on an old stone bridge,
sees the reflection
of himself in the water
flowing, unhindered, below.

I promise this will be the only work of mine that I include here, but let’s compare it to some snippets of simple code, starting with HTML:

  <div id=”content”>
    <h1>The Title</h1>
    <p>Some content</p>

Now look at some CSS:

div {
  border: 1em 0px;
  background-color: #444
  border: 1px solid #222;

And finally some JavaScript:

function cubeMe(x){
  var answer = x*x*x;

I want to highlight two key elements: the short lengths and the prominent indentation. These are both common elements of poetry and code (though not absolutely necessary to either).

This comparison is superficial at best, and there is a much stronger connection to explore. Still, this basic similarity reveals a certain visual relationship between code and poetry, which gives us an interesting entry point to discuses the subject.

A Master’s Art Link

This code-is-poetry metaphor comes at least partly from a perception of poetry as the master’s craft. Whether you love or hate it (and I know a lot of people hate it), there has always been a general sense that poetry sits at the apex of the written word, as though poets sit in an ivory tower, composing lines with a golden pen.

Of course, the reality is strikingly different. A lot of really bad poetry is out there, written by people who call themselves poets just because they can rhyme words at the end of two lines.

Does that sound familiar?

How similar is this to the proverbial “nephew”? You know the one: that kid who read the introduction to a high-school textbook about the Web, figured out a few HTML tags and is now driving you crazy with his offer of a “Web design” for $100 and a six-pack of beer. Makes you want to tear your hair out, doesn’t he?

Anyone who has been at this Web design thing for a while (or at least anyone who takes themselves seriously) would agree that there’s more to the job than hacking out content wrapped in a bunch of poorly structured and entirely non-semantic HTML. For those of us who strive to be masters of our craft, code is so much more.

Code has purpose and meaning. It requires structure. It should be lightweight and elegant, not bogged down with lines and lines of garbage. Writing great code isn’t something that just happens. It takes discipline and work! It’s an art unto itself.

Feeling impassioned yet? If so, you might have the heart of a poet. I’ll tell you why.

Of Pen And Purpose Link

Every good poem has a purpose. The purpose need not be so lofty as to change the world or to establish a new school of thinking, but every good poem needs a purpose. Of course, nothing is surprising about this. Many mediocre and poor poems are written with a purpose. The difference is in execution.

If a poem is written for a particular purpose, then the composition should reflect that purpose. The structure, word choice, subject and tone should all work together to support the primary purpose. For example, the purpose of Coleridge’s “Kubla Khan” is to capture the imagery of one of the poet’s (opium-induced) dreams. It famously opens:

In Xanadu did Kubla Khan
A stately pleasure-dome decree:
Where Alph, the sacred river, ran
Through caverns measureless to man
Down to a sunless sea.

The poem continues on in much the same tone, fully of lyrical and Romantic language by which Coleridge captures the essence of his dream. His word choice and form help the poem achieve its purpose.


A limerick is a different kind of poem altogether, one generally intended to be witty or humorous (and sometimes just plain crude). Here is one of the limericks I remember best:

There was an old man from the Cape,
Who made himself garments of crepe.
When asked if they tear
he replied, “Here and there,
But they keep such a beautiful shape!”

All limericks follow this structure and share this cadence, which contribute to the overall effect. The rhythm makes the text sound silly and light-hearted, whatever the actual words. While the poem is vastly different from Coleridge’s Romantic vision, it too demonstrates a keen understanding of its purpose.

Our code should be much the same. Different kinds of code serve different purposes and should be used accordingly. In Web design, the most cliched example is using tables for layout purposes. The HTML table tags were intended to present information in tabular format, not to structure an entire document. Using it in the latter way is a misappropriation of its purpose.

Any experienced coder would attest that tabular layouts are far more inflexible than CSS. They really limit you to the confines of the table itself. Styles, however, give you a great deal more flexibility and allow you to do a lot more. We may harp on about it a lot, to the point of being annoying, but it’s a perfect example of how failing to understand purpose can render code less effective!

CSS also provides a great example of the difference between inline, embedded and external styles. Each has a different purpose, and using it the wrong way can really weigh down your code. The external style sheet is used to implement universal styles that can be applied to an entire website (or, in some cases, multiple websites). The embedded style sheet, which is less frequently used, overwrites external styles. This is great for custom artistic posts. Inline styles can be used to overwrite the styling of a single element.

It’s all pretty straightforward for a seasoned Web designer. For the uninitiated, though, mixing up these purposes is all too easy, and it potentially results in bloated code, full of unnecessary inline styling and redundant elements, all from a lack of understanding CSS’ rules of precedence.

So, whether you code HTML or CSS, if you believe in the importance of understanding your purpose, then you certainly have something in common with the great poets.

Meaning Link

Another important aspect of poetry is meaning. Like any text, a poem means something on the surface: it literally means what it says, even if what it says is sometimes difficult to understand (especially with some archaic works). However, a good poem always has a secondary meaning, hidden beneath the surface.

The incomparable Robert Frost demonstrates this, in a stanza from his popular “Stopping by Woods on a Snowy Evening:”

The woods are lovely, dark, and deep,
But I have promises to keep.
And miles to go before I sleep,
And miles to go before I sleep.

On the surface, the poem’s closing lines simply state that the narrator thinks the woods are lovely but that he has promises to keep and a long journey before he gets to bed. But there is also critical discussion about the meaning that lurks below the surface of these lines. Not to go into too much analysis here, but it has been suggested that these lines indicate a deep yearning in the narrator to abandon the responsibilities of society and retreat to the embrace of nature, possibly even to death.


Again, code can be very similar, though in a different way. Instead of having a surface meaning and an underlying meaning, code (and specifically HTML) creates meaning through both its semantics and its structure. For example, consider these two lines:

<p>The Wasteland</p>
<h1>The Wasteland</h1>

The content is identical, but the context created by the mark-up is entirely different. In the first instance, the content is a paragraph (or simple body text). In the second, it is a first-level heading. The two are very different. Here’s another example:

<p>This is a paragraph.</p>
<p>This <em>is</em> a paragraph.</p>

The first sentence is a simple statement. But the emphasis in the second sentence on the word “is” changes the meaning. Now it becomes more of an affirmation against the (quite legitimate) claim that a single sentence does not really constitute a paragraph. Also, notice the choice of tag, using the semantic em tag for emphasis, instead of the simple italics tag.

Similarly, a language such as PHP provides contextual meaning through conditional logic. For example, here is a snippet of WordPress code that I often use to generate the content of the title tag:

  echo "Home :: ";
  echo the_title() . " :: ";
  echo the_title() . " :: ";
  echo single_cat_title() . " :: ";
  echo "Articles tagged as "";
  echo single_tag_title() . "" :: ";
  echo "Articles posted in ";
  echo the_time('F, Y') . " :: ";

In this case, the code produces a different title, based on the type of content being generated. It’s much different than our HTML example, but it still demonstrates the ability of a block of code to provide extra meaning to content—the same way that a poem’s subtext adds a layer of meaning below the surface.

The Importance Of Being Structured Link

A key similarity in the code-as-poetry metaphor is the need for structure. Poetry is traditionally a very structured form of writing. Take the sonnet, which was once widely considered one of the most elevated forms of poetry and is quite difficult to write (trust me, I’ve tried). Here is Elizabeth Barret-Browning’s famous “How Do I Love Thee”:

How do I love thee? Let me count the ways.
I love thee to the depth and breadth and height
My soul can reach, when feeling out of sight
For the ends of Being and ideal Grace.
I love thee to the level of everyday’s
Most quiet need, by sun and candlelight.
I love thee freely, as men might strive for Right;
I love thee purely, as they turn from Praise.
I love thee with the passion put to use
In my old griefs, and with my childhood’s faith.
I love thee with a love I seemed to lose
With my lost saints,–I love thee with the breath,
Smiles, tears, of all my life!–and, if God choose,
I shall but love thee better after death.

This poem, which appears on so much sentimental merchandise these days, follows the sonnet structure very closely. It has the standard 14 lines, with a specific rhyming structure. For the most part, it also follows the traditional meter, called iambic pentameter. I won’t break down the sonnet’s adherence to and deviation from traditional structure (because I would probably lose your interest). Suffice it to say, this poem is constructed on a very strict and rigid scheme.


There are other types of poetic structures, too, such as the brief haiku and the silly limerick (which we looked at). Some might suggest that much modern poetry is even more “free” and unstructured. This may be the case with lesser poems, but not with the best modern works. While these poems may appear not to follow a pattern, they are always structured in some way. You just have to look harder to find it.

The structure of code, though, is very obvious—in fact, probably more so than the rigid sonnet form. Let’s look at a basic HTML document:

    <title>A Simple Document</title>
    <h1>A Simple Document</h1>
    <p>This is just a simple document.</p>

As with the sonnet, a clear structure is at work here, one that is significantly different. The html, head and body tags all give form to the document as a whole, while the title, h1 and p tags wrap and semantically define different bits of content. For every opening tag, there is a closing tag, appearing at the appropriate place in the document’s hierarchy. It’s all basic HTML.

It’s also highly structured, and without this structure, the code degrades. In some cases, it could be a semantic issue, which often goes unnoticed, because browsers will usually correct these issues. For instance, we all know that the title tag should appear between the head tags, right? Well, if the title tag is placed somewhere else, most modern browsers will still understand the tag and render it properly. Semantically and structurally, though, it’s all wrong.

The same is true of improperly nested tags. Something like the following would likely render properly in the browser:

<p>A link to <em><strong><a href="">Smashing Magazine</em></strong></a></p>

And yet, it is structurally flawed, because tags should always be closed in the order that they were opened. Of course, things get really dicey when tags are unbalanced or when block-level elements intersect. I can’t be the only one who has been hijacked by a rogue div tag!

The point here is not to dig into the structural semantics of HTML, but to emphasize the importance of the structure in both code and poetry. If you’re nodding along with me here and agree on the importance of properly structured documents, then that’s another trait you share with poets and another bit of support for our code-is-poetry metaphor.

Trim And Efficient Link

Finally, in a well-crafted poem, every single word has meaning and purpose. Despite what may appear to be overly complex words or flowery lines, the entire piece is meticulously crafted. A poet can spend hours struggling for just the right word, or set aside a poem for days before coming back to it for a fresh perspective.

Let’s look at another of Robert Frost’s shorter works, this one entitled “Fire and Ice”:

Some say the world will end in fire,
Some say in ice.
From what I’ve tasted of desire
I hold with those who favor fire.
But if it had to perish twice,
I think I know enough of hate
To say that for destruction ice
Is also great
And would suffice.

It may be somewhat grim, but it is also exceptionally well crafted. Each word here is so carefully placed that not a single one could be removed without detracting from the meaning of the poem.

Ezra Pound’s “In The Station of the Metro” is even more succinct:

The apparition of these faces in the crowd;
Petals on a wet, black bough.

In just two lines and fourteen simple words, Pound paints a striking image, ripe with meaning and begging to be devoured by scholars and critics. Now, that’s efficiency.


Would you not agree that the same should hold true for code? Shouldn’t every tag, selector, rule and line of PHP have an explicit purpose? Unfortunately, making HTML and CSS bloated with unnecessary tags and styles is all too easy. Take this code:

  <p><span>This is a paragraph.</span></p>

div{margin: 1em 20px}
div p {font-family: sans-serif; font-size: 14px}
div p span {color: blue}

Now, compare it to this:

<p>This is a paragraph</p>

p{margin: 1em 20px; font-family: sans-serif; font-size: 14px; color: blue}

Assuming no extra margins or padding are applied to the original div, the second bit of code will render exactly the same as the first—a more economical way to achieve the same result.

As we mentioned in the section on purpose, code can also become bloated by unnecessary inline styles, where an external or even embedded style sheet would be more efficient (depending on the purpose, of course). Yet another example would be to use the onmouseover event to execute simple JavaScript effects that could be achieved more efficiently by CSS.

For the master craftsperson, great code and great poetry are lean and trim, with no excess of words or other unnecessary elements.

Conclusion Link

Part of the beauty of metaphor is its ability to highlight meaningful similarities between two seemingly unrelated ideas. Still, I have to admit that when I really considered this code-is-poetry metaphor, I was surprised by just how deep the similarities run. In some ways, the metaphor almost blurs into reality.

Perhaps code really is a form of poetry, and the coder a new kind of poet.

What does it all mean? I can’t answer that entirely, at least not here and now. But if more people regarded code as its own kind of poetry or at the very least put the two on more even footing, it would raise the bar and lead to higher-quality work. And that would only be a good thing!


Footnotes Link

  1. 1
  2. 2
  3. 3
  4. 4

↑ Back to top Tweet itShare on Facebook

Matt Ward is a physical product entrepreneur and crowdfunding expert behind Art of the Kickstart, a podcast and blog on all things crowdfunding. He is also highly involved in the world of Amazon sales building his own brands and cofounder of Amazooka, an Amazon on Autopilot software tool and podcast to help private label product entrepreneurs automate and scale their businesses.

  1. 1

    Haha for the first time I’ve seen my language on SM – looks like the photo in “Meaning” is from czech grammar dictionary =)

  2. 2
  3. 3

    Thomas McGee

    May 5, 2010 5:47 am

    Interesting article, and very creative. A nice out-of-the-box look to coding.

  4. 4

    “His word choice and form help the poem achieve its purpose.”

    Strange, I don’t remember Coleridge being quite so sarcastic about the failings of management to quantify caverns when I last read it.

  5. 5


    May 5, 2010 5:59 am

    Awesome post, Matt. I love this kind of “out-of-the-box” thinking! And if this kind of in-depth analysis doesn’t get people to re-evaluate their code grammar, then nothing will!

  6. 6

    Oh no, not the “Like”-Button again. I want my star-rating back.
    Thats the same crap on youtube now. Complete nonesense.

    Sorry for offtopic. But I had to say that.

    By the way. Nice article.

  7. 7

    fantastic and very creative article:)

  8. 8

    Chris Teague

    May 5, 2010 6:17 am

    Interesting perspective. At the end of the day the master craftsman isn’t building code for other craftsmen but an experience for a user – don’t lose sight of the bigger picture!

  9. 9

    Tomáš Kapler

    May 5, 2010 6:21 am

    two offtopics:
    1. Where did you get Czech-English dictionary? I love this connection of my favourite ezine with my mother language ;)
    2. You are not using wp_title filter for creation of wordpress title? What an old-school way ;)

  10. 10

    “Caverns measureless to management”?

    Really? Get some analytics code installed on those caves ASAP!

    This reminds me of that extremely valuable review of Tuscan Whole Milk, 1 gal., 128 fl.oz. on Amazon — — which begins:

    In Xanadu did Kubla Khan
    A stately dairy-house decree…

  11. 11

    Wonderful article. It’s great to see people look at the more philosophical side of things.

  12. 12

    Didier Durandet

    May 5, 2010 6:35 am

    var esoterism:string=null;

    if (poetry>esoterism) {

    function specule(poem:poetry) {
    bank.push (;
    if (bank.value()>business) {

    function sell(poem:poetry) {

    // Comment :
    // May be ‘Art’ is a coding activity
    // May be poetry is juste a status…

  13. 13

    Adit Gupta

    May 5, 2010 6:50 am

    I would like to bring a different viewpoint in terms of Beautiful code or Poetic code. I agree that it’s a good practice to write proper structured code which is clear and readable. However, this is not exactly the meaning of beautiful code. I would like to echo the thoughts of Jeff Atwood on this topic – “The beauty of code lies in the architecture, the ideas, the grander algorithms and strategies that code represents.” A truly beautiful code will amaze you at how brilliantly some complex functionality was achieved or how beautifully an algorithm was implemented. The structure and clarity is like make-up, which does not essentially represents the true beauty of a code.
    I agree that the points raised in this article are true for HTML and CSS, which are NOT programming languages. In this case, it’s all about structure and clarity.
    However, a “Beautiful code” has a different meaning when it comes to programming languages [Turing Complete].

  14. 14

    Dude, whatever you’re smoking, smoke less.

  15. 15

    Mick Foley

    May 5, 2010 7:18 am

    I’ll have what you’re smoking.

  16. 16

    Hihi the top Image text is Hungarian. This book is hungarian. Thats is cool.:D

    “egy jós vers értelmezése körül….

  17. 17

    (off topic also) Atleast on Youtube you get the option of disliking something -_-.

  18. 18

    I’ve always love that little quote on WP and it provoked some serious thoughts about coding while on the john. Lovely article. Thank you!

  19. 19

    Timothy Ritter

    May 5, 2010 8:46 am

    I believe for the first time ever, I have a deeper appreciation for poetry.

  20. 20

    Bizarre stuff. May I have some of the stuff you’re smoking, because I have not read anything more absurd than this in quite a while.

  21. 21

    Thanks for these interesting thoughts, Matt. I think the best coders are very careful about structure, and good structure makes code easier to revise and understand. I also think it’s very appropriate that you included a couple of examples from Robert Frost, who was classically trained and a lifelong student of classical forms like the sonnet. In talking about the benefits of working within a rigid structure, Frost once compared it to a horse learning to “run light in harness.” I’ve always liked that metaphor.

  22. 22

    At little too philosophical for me; it’s just code. Code = means to an end, for most of the world.

    But an interesting topic; one that’s not covered much!

  23. 23

    Phil Barnhart

    May 5, 2010 9:38 am

    var man = “nantucket”

  24. 24

    For sure: code in a form of poetry.

    I always felt that way and it was amazing to read the article and see that there are more people that think the same way.

  25. 25

    Great article. Loved the ending and I completely agree. If people could and would recognize the impalpable value of good code it would help elevate the profession as a whole.

    However, following the same metaphor for code as poetry, there are very few people who can really recognize great poetry. Only those who have studied it for years can begin to understand its true value and fathom its far reaching effects.

    And so it is with code.

  26. 26

    You nailed it. I couldn’t agree with you more.

  27. 27

    i’m sure this was a great read, but it was so darn long…

  28. 28

    This article is absolutely amazing – I Love the stress of importance on how you dedicated so much attention on the proper use of language as it was intended to be used. I personally find that I’m able to actually code much faster in development and re factoring when my code is semantic and the JavaScript is unobtrusive not to mention when I have to work with another’s code.

    – Excellent Work!

  29. 29

    Dude, wtf? By your logic, man == nantucket which is a clearly horrendous bug and not at all what you want to do. A multidimensional array is what you’re after:

    Nantucket = array(array(‘man’,’bucket’),array(‘gran’,’rocket’));

  30. 30

    You messed, man. You realllly messed.

  31. 31

    Your comment is the shit-tiest comment here..

  32. 32

    couldn’t agree more.. anyone who has ever tried to do something behind the scenes (excluding wp devs alone, who also realize this but manage to cope with their own code) hasn’t got nice words for wordpress code. starting with mentioned jeff atwood, but him not being alone here

    as far from poetry as it can get is the WP code, let alone pretty output HTML formatting as a result of the running code… the tagline is pretty much an irony of itself in this case :)

  33. 33

    Great article

    I was an English major in college, and have been a programmer now for going on 13 years. I didn’t turn on a computer in college unless it was to write an essay.

    People often ask me how i ended up writing software what with my English degree. I always explain the aspects of strong literature – structure, clarity, etc. – are also the aspects of strong code.

  34. 34

    I’m going to play the Devil’s advocate here. Personally, I’m getting tired of the trend of referring to code as art or poetry. The purpose of art is to convey beauty and meaning and to provoke thought. Poetry actually encourages the bending and breaking of a language’s grammatical rules and vocabulary.

    The purpose of code is to provide an interface through which a programmer can provide instructions to a computer. The structure must be sound so instructions can be transmitted in a fixed fashion–so nothing is ambiguous; nothing can be interpreted in more ways than one. That is in stark contrast to all forms of art, wherein meaning is often intended to be ambiguous in order to provoke discussion.

    Yes, there are similarities between code and poetry. They’re both composed of languages which use a set of rules. They both have structure. They both convey meaning. Those similarities are common among any forms of communication which use written language. Therefore, it might make sense for me to claim that “Code is Chinese.” Why not? They both use symbols, have structure, obey grammar rules, and convey meaning. If that seems silly to you, then you’re getting my point.

    So please, let’s stop kidding ourselves. Code is not poetry, nor is it art. It is science. It is fixed communication–simplified language. Software can be art! We’ve all probably played games or seen animations which were beautiful. So in that sense, code is the language we use to write a poem; code is the paintbrush we use to paint a picture. If art is anywhere, it’s inside us, and inside what we produce.

  35. 35

    Coleridge defined poetry as ‘the best words in the best order’. That’s got to be a perfect definition for code too, right?

  36. 36

    Thanks Matt for this wonderful comparison and intriguing thoughts! Made my day!

    eliZZZa from Vienna

  37. 37


    May 5, 2010 1:51 pm

    Your logic seems to be misplaced a bit. If we’re going on analogies here, then yes, you’re right “Code is Chinese” but it is the WAY we write said code that can turn it into digital poetry. Words are the code, but it is the way we arrange the “words” that turns them into poetry.
    Yes, our code is meant for machines; no argument there. But we’re the ones that write it, edit it, maintain it.

  38. 38

    Billy Kzov

    May 5, 2010 1:53 pm

    You are so fugging wrong.

  39. 39

    Niels Matthijs

    May 5, 2010 2:05 pm

    >> Assuming no extra margins or padding are applied to the original div, the second bit of code will render exactly the same as the first—a more economical way to achieve the same result.

    (Might have been mentioned already)
    Actually, since you’re applying a font + em-margin on the same element in your second example, the rendering might differ 1px on top and bottom from the first example, where the font won’t effect the margin on the surrounding div.

    But anyway, html is not about economic styling, it’s about structure and semantics. So if your div could hold one or more elements besides that p which are by themselves related to the paragraph, the div is still probably the better option.

  40. 40

    Hey all. Thanks for all the really interesting comments! I knew that there would be a lot of strong reactions to this article – some people would love it and others… well not so much. Either way, thanks for reading (even if it was a little long).

    Just to clarify, the post was not inspired by any inhaled smoke or other mind altering substance (except perhaps my own imagination). Just not into that sort of thing. I am a creative writer myself, and have tried my hand a bit of poetry in the past. I’m also a bit of a theory head and lover of philosophy, so this kind of thing was right up my alley!

  41. 41

    Absolutely! Great insight.

  42. 42

    Sorry about that Matt. I am somewhat prone to long-windedness.

  43. 43

    I absolutely agree. We can never lose sight of usability in an effort to make beautiful code. Thanks for the comment Chris!

  44. 44

    Jonathan Fromsten

    May 5, 2010 2:46 pm

    I’ve always thought poetry and code go together like Jabberwocky and Actionscript…

  45. 45

    Calling code poetry is not inaccurate, but it is still just a subjectively way of romanticizing it. Ultimately, coding is science. It’s logic, it’s problem solving, it’s critical thinking. Just as much good code has come out of cold, tangy logic as any other approach. One could almost say that anything in life performed by a person who takes it seriously is done so as a sort of art form. You can really just boil it down to that. Someone doing what they like with their personal gusto. They’ll be creative as much as calculating. Coding can be an art, but it’s also stone-cold science. Because of that purgatory, so to speak, I don’t think it’s poetry (which, to me, is being more so on the art side). But some people probably see the balancing act of pulling code from those two disparate sides is the poetry, the mating.

  46. 46

    Lars Hundere

    May 5, 2010 4:11 pm

    This chimes well with the current enthusiasm for Web Standards. Hooray for web literacy!

  47. 47

    Makes perfect sense to a poet who turned to web design/coding!

  48. 48

    In 1995 I was working at SGI (rip) as ‘WebMaster’ of HR. We offered internal courses on everything technical pertaining to SGI systems. I had the opportunity to take a PERL course from Larry Wall.

    When Larry was writing the language, his wife, a Poet, said to him that his language was very poetic… so he went on to modify PERL to allow for the flexibility desired by poets.

    Thought you would enjoy the history ;)


  49. 49

    I agree. I find the author’s point of view too romantic. Also, I find that using HTML/CSS to demonstrate his view is a bit wrong – as people already pointed out, HTML/CSS is a markup language. Therefore, it’s probably not the best example to use for this article. It just sounds the author might not have a solid understanding of the topic. Anyway, I just think the article just tries too hard glorifying his profession. If he’s going to write another article in the future, my advice to him is: “don’t try to make yourself sound more important than you really are. It just makes yourself look self-indulgent and obsessive”.

  50. 50

    Very intersting and uncommon type of article. Nice read.

    I too think the code-poetry metaphor applies, good coders love their code down to every word of it (and also struggle hours to make the best choices).


  51. 51

    Something should be said for the actual content and function of code as poetry along with this long-winded treatment on its form. I find the most elegant solutions or algorithms come in the most ugliest forms – a mash of curly brackets, parentheses and essential variables. To continue theme, here’s a 40 sec part of a K’naan verse from the first track on his J.Period / Fela mixtape that features one rhyme (*ell):

    it’s hereditary how i’m sick as hell
    so it might as well have been sickle cells
    i chip with nails and expose the soul as my mission tells
    my hard knock no whistle and bells
    i grip in my palms some sizzling shells
    and load up the clipse in the glistening hell
    bloodthirst consumes my vision and smell
    i started broke and in ambition i fell
    and life ain’t give me no fish n no well
    these streets is my only additional wealth
    nobody understands the condition i held
    from where i came to position i held
    and now i’m not takin no bitch in this well
    L I S TEN is i listen i spell
    my schoolteacher used to mock pissed and yell
    cos I used to speak with a lisp until
    i learned to let the pistol spit my will

    He could have easily told the same story with four different rhymes, but it wouldn’t have sounded as clever.

    Simple example from code:
    a = a+1 vs a++

    In short, the use of the code – what the code is actually able to do and with what kind and amount of resources – is where the art lies.

  52. 52

    I’m glad you stepped away from the reference to WordPress as quickly as possible.

    While code can be poetic, WordPress code is not on my list of examples.

  53. 53

    Caesar Wong

    May 5, 2010 7:23 pm

    This post would not be complete without haiku compliant HTML:

  54. 54

    Agree with Allen – WordPress code can’t be a good example, and I just can’t understand how can WP team say “Code is poetry” having such a mess in core wordpress code, especially in admin area. Some Ruby on Rails code or at least the code based on some PHP framework such as Symphony would be a better example.

  55. 55

    Carlos Braga

    May 6, 2010 5:31 am

    Very interesting article!
    I’m graduating from university with a degree in English Literature, and I’m also a Coder and Web Designer. It’s nice to see someone who get to web in this roundabout way!
    I think Concrete Poetry is very related to the field!

  56. 56

    Lokesh Yadav aka. Lucky

    May 5, 2010 9:06 pm

    Hey Matt ! you made my day mate

  57. 57

    Hi Matt,

    Excellent Post.

    Keep it up.

  58. 58

    Interesting article– a college professor actually gave a similar dinner lecture on this exact topic back in ’91, I think, although he spoke more to the unique nature of each individual’s approach to writing code. I know that at most of the places I’ve worked, I can tell who wrote something just by reading the code.

  59. 59

    Leila Salemde

    May 5, 2010 11:11 pm

    Sorry Matt – I don’t get it. Maybe my brain is not wired same as yours :)

  60. 60

    I’ve seen two comments which say that “code is science”, I disagree to that. and I’ll put my argument here: science is about what we don’t know, it’s investiagation and experimentation. For my perspective, code is engineering, and for that almost every engineering includes it’s grain of art, because all engineering seeks the best solutions/products, it takes dedication and time both to learn and develop, such as any good art. There is a lot of engineers who love their work, also each work is unique, the matter here is that engineering (while being beautiful) is much more constrained than most art, and far less subjetive and also less ambiguous. That said, if being more rigid to an structure, a purpouse and a semantic, makes a work more valuable… let me put it like this: engineering > art (this is wrong, I’ll show why below).

    Both engineering and art were a technique at it’s beginning, and guess what? every technique was born from science. I’ve been unable to stablish why a technique becomes art or engineering, but I believe that when a local maximun quality is reached on engineering then there it opens a space for art within it…. Say, who would be doing graphic design if you had to place pixel per pixel? Of course there would be a few, but trust me, they wouldn’t decide by their taste what color to put if redoing it where too expensive, they would be too much in how to do a fading effect to think in the spiritual aspect of their creation. Also when software programming was a new born, people will say that it was a cold job to begin with, perhaps romantics will still say it’s an art, but blood, sweat and tears was all the feelings in those perforated card, that was done because it had to be done, not because they wanted to express the beauty in their dreams… to express the beauty of a dream in software you got to wait to operating systems to appear, and the firsts IDE to come in… then programming lastly became into something confortable and cheap enough to do at home because of pure desire. Put on this way then, art comes from engineering, so: art > engineering. This also means that art comes from the free decision to follow the rules, put on another way: if it weren’t possible to it ugly, it weren’t beautyful.

    Lastly I want to mention that there is people who actually do experimentation with code. This kind of work (investigation) requieres that you have a meal and a bed secured, so you can put your time in something that can takes ages to translate into money. Then that when coding is science. Usually developers reach this level, when they can find time (by job or not) to do things such as create their own programming language, their own database engine, their own game engine, or even their own operating system. But those guys are the exceptions, they are less than 1 in each 100000 (my guessing). For they, coding may be both science and art. They are the guys above the “don’t reinvent the wheel” meme.

  61. 61

    Rodney Keeling

    May 5, 2010 11:57 pm

    And this is why Smashing Magazine is so great. Awesome post, guys!

  62. 62


    you need to know about Don Knuth’s work on Literate Programming, a powerful link between program exposition and coding (,

    – Yves

  63. 63

    There was a Youtube blog post about the use of the star rating system, and it seems that 99% of the ratings were either 1 star or 5 stars, which is the reasoning behind the change. There must be something about the psychology of how much you like something, and those who are somewhere in the middle don’t care enough to rate. Either way, I can understand the reason to have a like and dislike system, and perhaps all we really need here is the addition of dislike as Matt said.

  64. 64

    Great Post!

    This is Matt’s expression of what good structured code means to him. It’s not wrong or incorrect, its an expression which most of us relate too.

    great expression!

  65. 65

    Ecommerce Design

    May 6, 2010 2:28 am

    Definitely an article worth reading. A new outlook on how to look at codes. While reading the article you definitely have the point that code and poetry are somewhat related.

  66. 66

    Álvaro (from Portugal)

    May 6, 2010 2:45 am

    Excellent post.
    The first time a ever look at code that way, was in this amazing article, By Gavin Edwards, about universal languages (wired mag.) [ ].
    The web semantics is going to increase more this relation between words, meanings and function. Keep up the god work.

  67. 67

    double time, me= !0XFACE,
    not; int rested, get, out;
    main(ly, die) char ly, **die ;{
    signed char lotte,

    It doesn’t compile, complaining about “Incompatible Types” :)

  68. 68

    Dominic Watson

    May 6, 2010 3:42 am

    I don’t see how coding HTML/CSS is an art or any form of poetry… You’re trying to squeeze juice from something very simple. I agree with Chris and David on this one. I don’t quite understand how you can have so much passion for such a basic language.

  69. 69

    Do you really think that poetic code looks like this?!?!?:

    if() {}
    elseif() {}
    elseif() {}
    elseif() {}
    elseif() {}
    elseif() {}
    elseif() {}
    elseif() {}
    elseif() {}

  70. 70

    Ryan Schenk

    May 6, 2010 6:43 am

    The similarities between code and poetry run even deeper than you describe here. The resemblance you’ve noticed exists superficially—at surface level—but indeed the definition of programming languages is much more intimately tied to linguistics and language than that.

    If you talk to a computer scientist about the design and construction of programming languages, they will talk your ear off about the nuances of syntax and grammar—what is language, and how does its structure determine what we can express. For instance, the great linguist (and thinker) Noam Chomsky made enormous strides in this realm of computer science with Chomsky Normal Form, a normal form of Context Free Grammars.

  71. 71

    Russ Reese

    May 6, 2010 7:53 am

    First let me relate my personal story – I wanted to be a songwriter since I was nine. So I wrote a lot of songs but couldn’t make a living doing it. I didn’t start programming until I was 39. In some inexplicable way it seemed to satisfy that same part of me that wanted to write songs.

    Building a system is like writing a symphony. When you write client pieces and server pieces and helper apps and design the database that it all works with – then you hear it “played” it’s very gratifying (until you hear that oboe part that you knew you should have done differently :)

  72. 72

    Matti Schneider-Ghibaudo

    May 6, 2010 8:40 am

    I, like a lot of other people around, believe I am able to understand the inner beauty of a well-written program. And I also go to the same conclusion: it is more about how a huge problem could be solved in such a simple, clear and clever way. This is where the feeling of awe comes. It also comes when you first see a huge pile of files and an enormous amount of code and realize after having spent some time analyzing it that its architecture is so right, how every single class relates to others… It might come when you read this self-modifiable code that looks like a nonsense but actually does something incredibly complex in just ten lines because it was so well-thought.
    At least that’s when I get the feeling of beauty of code.

    Perfectly semantic XHTML is nice, but it is much harder to get a real feeling of beauty from it. In webdesign, I think the most likely thing to bear actual “poetry” (at least in my definition of it, and I don’t totally agree with the word) is with a CSS cascade that is so well-thought that you have to read the whole file ten times in a row before you’re able to understand how such a perfect layout could be achieved with so few instructions.

    And of course, ugly code is the opposite.

    I think this feeling of beauty is the same that comes with a lot of other objects: a unibody MacBook Pro looks so much better than a Titanium PowerBook because it’s so uniform, you can’t see a screw, you just have this perfectly united texture: it doesn’t look like a computer full of wires, it looks supernaturally simple. When you see all the gears out of the machinery, it doesn’t feel magic anymore.

    And isn’t it what separates poetry from functional communication (or good poetry from bad poetry)? Poetry conveys meaning, and it usually follows strict rules, but you don’t see the language behind it. You’re not focused on the grammar, nor can you see the obvious “tricks” that were used by the writer: good poetry flows, it is all about the images that form in your mind, and not about the words at all anymore. And a single mistake in a poem might break the whole feeling you get out of it. I guess all the programmers around can relate this to when you read some code, start to feel like it’s pretty good, and then see an awful a = a + 1;.

    Anyway, let’s sum up my point of view on the question of considering code as poetry: I think that the subject is important, and that a lot of programmers are able to feel the beauty of some code pieces. However, making such a part-by-part comparison as was done in the article is not the best way to prove anything about it: just saying that indentation and structure are important in both cases doesn’t mean anything. I agree with the idea that we could as well decide that Code is Chinese with this kind of syllogism.
    Isn’t Art all about how something makes us feel? I think that’s all we need to say to prove that coding can be artistic: sometimes, it makes you feel connected to the artist, connected to the piece. But it seems to me as stupid to say that “code is poetry” as saying that every single drawing is artistic, or that any structured written text is poetry: code is there to make a computer do something. But, just like sickdesigner put it: we are humans writing code and reading it. Most of the time, the code will be written only to fulfill its goal, manipulate the machine to make it fulfill its task. However, sometimes, there will be something more in it, a small piece of the spirit of the creator. And it won’t make a difference to the machine, but it might make a difference to the human feeling it.

  73. 73

    Matti Schneider-Ghibaudo

    May 6, 2010 8:42 am

    Totally agreed… This is not poetic at all, this is actually quite awful.

    I think it is a good illustration of how much this article treats an interesting theme, but tries to make its point with very bad syllogisms.

  74. 74

    Good poetry means something different to everyone, the interpretation is what makes it beautiful and unique.

    Good code has the same meaning everyone, clear, concise, and an unmistakable interpretation.

    While the two crafts can be related their goals are completely different.

  75. 75

    Mark Kenny

    May 6, 2010 9:35 am

    I love the WordPress slogan, and I do kinda get “code is poetry”. For me though it’s all about the typography. I am a designer too, and I LOVE well designed fonts. My favourite rendering of code is in Consolas, 13pt. It’s beautiful, especially in italics!

    Can’t take my eyes off code in Consolas 13pt!

  76. 76

    dobrej postreh :)

  77. 77

    Nice post Matt. Thanks for taking the time to write this.

  78. 78

    Martin Chaov

    May 6, 2010 10:58 pm

    as poetic as go to() in php…

  79. 79

    Hugh Collier

    May 6, 2010 11:45 pm

    What a great article! Even though after some consideration I think I disagree with the sentiments expressed. I shall try and explain but I’ve been up all night watching the election coverage so forgive me if I don’t make sense!

    We often use the word “Poetry” as a metaphor for a system where the outcome is greater than the sum of it’s parts. In that sense Code can certainly be considered Poetry. However when we bring Art into the equation things change and written Poetry in the literal sense is definitely Art.

    In my view Art can never be truly functional because as soon as something is created to serve a specific function it crosses the bury boundary that exists between Art and Design and becomes a piece of Design itself, albiet sometimes with Artistic value and merit. By this logic Code can never be considered Poetic (in the true sense of the word) since it’s created to serve specific sets of functions. I’m not saying Code cannot be beautiful or creative – just that great Code by my definition of Art can never be considered Poetry.

    Great article though Matt, you’ve definitely succeeded in sparking some of the best, most considered and thought provoking comments I’ve seen on SM for some time.

  80. 80


    May 7, 2010 1:49 am


  81. 81

    different perspective, but very interesting. :)

  82. 82


    May 8, 2010 1:55 am

    Good attempt……inspiring article.

  83. 83

    But personally i would like to amend some of the points in the post ..!!

  84. 84

    Thanks, man! Genius!

  85. 85

    No, this is pre-ejaculate from an adolescent.

    Don’t post this ****. You undoubtedly do not know what poetry *or* code is. This is superficial bullshit from a youngster.

    poetry is the very antithesis of code.

    Learn life.

  86. 86

    Article is simply superb.. I am both poet and coder. I agree with the most of the point u pointed out :)

  87. 87

    Mostly though, this reminds me of that larson/farside drawing when there’s an engineer standing behind the struggling/dying poet and says
    “i think he is trying to communicate”.

    Kudos though for your attempt to think outside of the box. it means you’ll win, in the long term. I think by reading the first 86 comments here you get my point (comment #79 above, LOL)… that the big majority of system developers out there are definately not what you would call poets. In any definition known to man, they do not write poetry.

    What wordpress is trying to say is probably that they (or some of the crew) think that written code on paper can be as beautiful to watch as poetry is (to them), when you really understand the purpose of that code.

    I have encountered a lot of mediocre programmers that likes to read “poetry”, but writing it, well, that is something completely different than programming, and a very difficult skill to master.

    Enough said.

  88. 88

    I didn’t mind reading all the comments but I caught something with the corner of my eye which in turn becomes this:
    “This article might sound nice but it’s only based on similarities, which is also how jokes are made (there you have another one BTW), you can do that with almost anything. What’s more, this article can also be understood in this way: since our code is intended for CPUs, and since we can understand it too, then we are becoming more like computers too (and viceversa but a slower rate). We are becoming the machine, just like we had become the mind.”

  89. 89

    This article is one of the best guideline to developers. My plea to include this type of guidelines in the syllabus topic, to develop Good and organized developer.

    @ matt : I love the style of writing, I enjoyed a lot while reading your articles. keep posting :)

    Code is Poetry.

  90. 90

    What a beautiful article! I’ve always loved language, and code, and have actually been thinking a lot recently about the relationship between the two. Thanks for writing this =D

  91. 91

    Will D. White

    May 11, 2010 6:51 am

    Love it.

  92. 92

    Gotta love the Superficial Similarity.

    It’s cool what you’re smoking, I don’t judge. :)

    CSS is the truest beauty. Or I’m just a CSSw/h/o/r/e. Either way.

  93. 93


  94. 94

    man from abroad

    May 11, 2010 3:53 pm

    Poetry is actually more about **sound** than about structure imho, kind of subset of music. Coding is, like music, the act of creating structure.

    (Music still sounds better than code.)

  95. 95

    Interesting and thought provoking post, thanks! You could say that code produces poetry – just look at the example of dubli!

  96. 96

    Egor Ivankin

    May 12, 2010 11:25 pm

    — Is this Mayakovsky?
    — No, this is python.

  97. 97

    Great post! Absolutely hit home with this one. I feel strongly about all the points you covered, code structure, cleanliness, and efficiency are extremely important to me, and all help add to the good feeling I get about a project when it’s finished.

    Definitely put some passion back into my work, thank you very much. :)

  98. 98

    True beauty is found
    in the immaculate accuracy
    of running code.

  99. 99

    It’s funny that I should stumble onto this article now. I recently wrote a poem “in CSS”: shayla.css

  100. 100

    Que increible post!
    La verdad, estamos locos para llamar “arte” a nuestro código, a nuestra vida… pero es cierto.

    Codificar sientiendo cada tecla/letra es hermoso.

  101. 101

    Give me a break. I dig WordPress but they can stuff the whole “code is poetry” bit. Code is poetry just as true as form over function. I don’t write validation scripts thinking to myself, “oh, I hope this regular expression looks pretty and my code looks cute.” When I write a validation script making it look poetic or “flow” is the LAST thing I would ever think of. In fact the only thing I think of while writing a validation script is “this thing is going to keep some sorry ass from scamming my form.”

    Any programmer that approaches code from a “poetic” stand point should STOP CODING. That would be like approaching science from an artistic standpoint. Sorry the world’s problems can’t all be solved by paintbrushes and rainbows. I’m sure somewhere you could squeeze an exception or two in there but for the other %99.99999999 of the time that mode of thinking is what psychologists often refer to as “MAGICAL THINKING”.

    Grow up.

  102. 102

    Your article impacted me profoundly in more ways than one: from my amateurish attempts at coding to life in general…

    This line especially is still resounding in my head like a catchy refrain from a wonderful song:

    “So, whether you code HTML or CSS, if you believe in the importance of understanding your purpose, then you certainly have something in common with the great poets.”

    You are one very gifted writer.

    I’m a fan.

  103. 103

    Christian Sciberras

    September 15, 2010 4:49 pm

    Hello Matt!

    Very interesting article, one which I agree with to it’s entirety.

    In the last few sentences you posed some interesting questions, which I’d like to reply to.

    First, a little background; I’m no linguist – by far. However, the best I consider myself at, is English (which, alas, is not even my native language – go figure :) ). I’ve developed code for different environments and in different languages. I can say I’ve passed through the pain of, not only seeing bad code, but even having to fix it!

    But back to your question. You asked if someone could bring light on how/why the metaphor seems so realistic.

    As we all know, all computer languages have been evolving, be it due to hardware, software, complexity or simply age. But there’s a pattern to it; each update brings more features which usually mean; writing less code which, however, does more.

    And that is the key to the answer. First of, we can see how simple snippets express so much more than it’s textual equivalent of a poem. Don’t get me wrong at this point; don’t forget that the English does not readily change like code, there is a different in pace. While a piece of C code could be rewritten in PHP, I don’t expect Hamlet translated to Maltese any time soon (and of course, keeping the same structure).

    So we’re seeing a change, the computer seems to [expresses] itself better with just aa [little] of [beautifully] [crafted] code, which will break up even by removal of a simple character.
    I admit I’m not much of a poem-lover, but aren’t poems [short]and [sweet]? To me it seems simply a matter of expression usig a different medium.
    Perhaps “Code is Art” might have been more to the point. But given the current bulk/mess we have in arts, I think Poetry would be much more appropriate.

    Hope my text was as enjoyable (or at least entertaining) as much as I did in enjoy your article Matt.


  104. 104

    Wow! This article was very thorough and well-versed in poetry and coding techniques. I would have liked to see less about poetry and more about best practices in coding, although it was interesting….a tad lengthy?! Thanks!

  105. 105

    Jonathan Copnell

    February 5, 2011 8:01 am

    I’d just like to mention the separability of concepts here.
    Code as poesy is a delightful metaphor,
    perhaps not as deep as Lear,
    yet thought provoking in its comparison
    is what makes it dear.

    Beauty in code is different and separable, as is beauty in phrase,
    only synonymous if ‘the best words in the best order’ as Coleridge says.

    Beauty in Physics derived from beauty in Math is well known and renowned,
    with analogies to both code and Coleridge’s idea of poetry particularly sound.

    Simplicity, elegance, inevitability and completeness are common to all three,
    useful as guiding principle and giving pure pleasure to thee and me.

  106. 106

    Nice job. I have been coding since 1965. Code has always been poetry to me.

  107. 107

    This exciting reading!!! the article exactly describes my feeling. it is also possible to see similarities between code and musical notation (especially in the case of J.S. Bach). And one of the best pieces of code-poetry is that of the Fast Fourier Transform (FFT) algorithm, highly recommended for bed-time reading :)

  108. 108

    I think, if I may say so, that the author sees not only the results of his work, but also the beauty of the road towards it. He thinks out-of-the-box. Unfortunately most coders stay inside their box. A pity.

  109. 109

    No, dufus. He’s clearly creating “man” *from* “nantucket”. Simples!

  110. 110


  111. 111

    I’m curious to find out what blog platform you are using? I’m having some small security issues with my latest blog and I would like to find something more risk-free. Do you have any suggestions?

  112. 112

    exactly. Code poetry has been talked about but in real code not markup. Talk about code poetry in Smalltalk or in Perl even and it makes sense but not HTML !

  113. 113

    Love the phrase “Code is Poetry”

    It’s cool to say and think because, Code is Not Poetry.
    So when we think and say it, two worlds collide – which is food for the brain.

    Who doesn’t love a bridge between science and art?

    But getting hired to write poetic CSS? I don’t think so….
    When I’m on a deadline coding CSS for a business/client, the LAST thing anyone wants, is for me to start crafting the CSS similar to how I would craft a poem.. ie. sitting under a tree, no thought of deadlines, writing and erasing and writing, words to fit nicely into a poem, with only a fleeting glimpse here and there of what feels right, hoping to draft a poem that feels like a snowflake of symmetry and individuality…. that’s not what I’m getting paid to do when I write CSS. Sure, I can inject poetic solutions to faster-loading code, but my client did not hire me to spend hours obsessing over a line of code b/c one day another coder will read it and say, wow, what beautiful code. Can you imagine billing for more poetic markup?

    The neat about the phrase “Code is Poetry”, kudos to WordPress for using it as their tagline, is not only the fact that programmers are becoming more and more valuable as creative designers, but I think it gives voice to a movement bubbling under the surface of design/development culture… that voice is really saying is: DON’T FORGET, even in an industrial, scientific craft like markup we can include human individuality, organic-like answers to machine-like rules…

    There was a previous mention of Concrete Poetry in a reply above.. Yes. There was keen movement of “Concrete Poets” in Brasil and Switzerland in the 50’s,
    ….there were a bunch of poets SELF-PUBLISHING, small-press, indie-publishing pamphlets of original poems.. ( like today’s WordPress/blogs, right? “…simple daddy don’t you know that things go in cycles…” -Q-Tip. ) … the main idea for the movement of these poets/musicians/artists, at least as I understand it, was that as Brasil was becoming modern, designing new cities and industrializing in general, Poets were suggesting we keep Poetic sensibilities and check in with “human progress” , what that means…. Unorthodox ideas for example, next to an industrial sign in the street letting you know about a rule, why not also display sign beside it that has a short poem.. a poem that isn’t designed to buy a product, but actually a poem that helps you think for yourself about something poetic and the human condition.

    This movement of poets greatly influenced Brazilian musicicans/artists, as well as in USA’s Art Culture, not only singer songwriters but also I connect the Concrete Poets message to the original graffiti artists in NYC… whether that was a direct influence or not.. graffiti painting “human” elements of colors, non-corporate name-tags, hyper-stylized non-industrial forms painted into and on top of the cold, dull, industrial spaces… (using industrial spray cans, to round out the irony) … that’s poetry jumping out through the codes of industry/commerce.

    The gem inside the phrase “Code is Poetry”, is similar to Concrete Poets of Brasil, OG graffiti artists in NYC.. it’s a reminder: Don’t let “Poetry” (human creativity and sensitivity) die of neglect during an industrial/scientific boom, because “progress” should also include nurturing the fathomless depths of the human spirit.

    All in all, I’ve enjoyed the article and replies, and am game to talk more on this topic.. Ive been working “Code Poem Paintings” , such as ….studying the relationships of code/composition/memory in raga and jazz, so this topic is one of my favorite to explore..

    thanks, Matt for taking the time to write the article, I’m hope I’m not too late in jumping into the conversation…



↑ Back to top