I’m a poet, lover of literature, and budding Ruby student. Even as a lover of language, I never thought to explore computer language as a way to enhance my knowledge and appreciation… until I started working here. In writing code, you face similar obstructions as you do in poetry: context, line breaks, stanzas, even word-choice.
As I revise and revise a program I’ve been working on, I realize how the content of the program dictates the form, just like in poetry. A stanza and a block of code are both rooms within the larger piece. Indentation can be used as a way to signal a change (in tone, movement, concept) to the reader in both a poem and a program.
Look at these screenshots: one is part of a Ruby program and one is a contemporary poem. It’s hard to tell the difference!
I think it’s possible to compare the arc of a program to the dramatic structure of a piece of literature, like Freytag’s triangle. (Although, that’s another post entirely…)
How else do you see form across languages and genres?
Taylor
on 20 Mar 12Really enjoyed this post KA!
Andrew Banks
on 20 Mar 12You’re right! Other likenesses between programming and writing: (1) Revision is necessary to make it great. You almost never put it best at first. (2) Shorter is generally better, and you can often revise to half or even a quarter the length. Recommended reading: The Elements of Style, by Strunk & White; On Writing Well, by William Zinsser.
Anurag
on 20 Mar 12Nice analogy. Like someone said Programming is a computer geek’s poetry.
Blacktiger
on 20 Mar 12The one on the left is a ruby program.
Joe Bruno
on 20 Mar 12User interfaces are also poetry, and even more so than programming. Unless a UI element looks and sounds perfect and all its explicit and implicit meanings are pointing in the direction you want them to point, it shouldn’t be there.
Julie Meloni
on 20 Mar 12You may be interested in what’s called Critical Code Studies (to a greater or lesser degree depending on your tolerance for academic speak…there are some folks in the group who are actual down-to-earth programmers and notice the same beautiful things you do).
rdo
on 20 Mar 12unless blank space and indentation have a true semantic meaning (i.e. as in Py) I think the parallel you drew is purely aesthetic. In py (and any other identation-sensitive language) the parallel is much more material.
Tom
on 20 Mar 12Poetry, however, has the advantage of not requiring as much analytical energy as programming or even music does. Part of the win for poetry is that you can do basically anything, without any regard for how anyone else is going to see your work (because “see” is relative…one can be exposed to your poem with a single line, an entire passage, in a song, or recited somewhere). With programming and music, you must always be cognisant of how others relate to your work, modifying it to fit in with those frameworks and confines. You can’t just give a horn player a bunch of notes you wrote down from memory and expect them to play it right. You need to modify the score so it works for their eyes, just like how when you need to solve a problem whose code is malformed/FUBAR, you re-align everything so you can read it better, thereby solving the problem faster.
Justin D-Z
on 20 Mar 12In 2006, I gave a presentation in India about the intersection between code and poetry. I think it was well received. It was about treating coding as a craft, studying the writings of other people who are considered masters and recognizing that most good poetry is the result of extensive refactoring and not simply barfing awesomeness onto the page and then refusing to touch it for fear of tampering with the muse.
This is a good topic and one that I would love to see addressed in some fashion on CS courses, if only briefly. Good writers read other writers and learn from them. Code should be the same way.
Josh
on 20 Mar 12Great post. I think it goes back to the way we read and compartmentalize text. We read in shapes. If those shapes are too big, small, or disoriented, we become uncomfortable.
Patrick Thomas
on 20 Mar 12I’ve always said that code is art….
Evan
on 20 Mar 12It’s “no parents, no rules” on the blog today, eh?
Radex
on 20 Mar 12It’s awesome to see that in this company even support crew is learning Ruby ;)
michal
on 20 Mar 12Great analogy! I’m also fascinated by literate programming [1] and the work Jeremy Ashkenas does with CoffeeScript.
[1] http://en.wikipedia.org/wiki/Literate_programming
Scott Chamberlin
on 20 Mar 12The french writers group, Oulipo, took ideas from mathematics (and algorithms) and applied them to literature. http://en.wikipedia.org/wiki/Oulipo
They explored the form similarities you mention as well as generative writing techniques, and leveraging mathematical and algorithm constraints in their writing.
Italo Calvino is probably the most famous writer from this group and he’s written some great stuff. Some of the other works like “Life a Users Manual” are still published but can be a bit dry.
Ryan Cannon
on 20 Mar 12@Tom:
I think that if once you’ve edited a poetry anthology or coordinated a public poetry reading, you’ll feel differently. The things you state as differences are actually similarities once poetry comes out of the notebook and into the public.
Pavel Druzyak
on 21 Mar 12What about +1 button? http://www.google.com/+1/button/
bartaz
on 21 Mar 12There is even a project called code {poems} that gathers poems written in different programming languages to print them as a book
Pierre Chapuis
on 21 Mar 12Ruby is strongly influenced by Perl in that respect. In Perl, code as poetry is a cultural thing, probably because its author is a linguist who was more influenced by natural languages than by formal ones.
If you have never read Perl poetry, start with this classic: http://www.perlmonks.org/?node_id=578707
I wonder if the Japanese influences in Ruby make its poetry drift towards haiku :)
Peter Kaizer
on 22 Mar 12Just look at the footer of wordpress.org, it says Code is Poetry…
silas
on 22 Mar 12your customer service was truly super dooper today. tks y’all.
Martin
on 23 Mar 12I would even go further and say that the asthetics of well written code and well written poetry is the same.
One difference, however, is that in poetry you don’t have compilers and interpreters that will tell you whether or not your poem is faulty. You need people for this – and even then you can never be sure. :)
Dan
on 23 Mar 12This is spot on, my code is poetry! My error log, on the other hand, is a heckling arsehole.
This discussion is closed.