Is Programming Poetry?
Yes and no.
It must have been 1983, because I was a sophomore in college. My roommate invited me to check out Computer Science 201, the intro class for majors. I was set on majoring in math, but I tagged along.
When we got to the lecture hall, there at the front was the legendary Alan Perlis, head of Yale’s computer science department. The first recipient, in 1966, of the prestigious Turing Award, Dr. Perlis was one of the inventors of ALGOL, a precursor in many ways to more modern languages like C. By the time I met him, he was getting around campus in a wheelchair.
Most professors kicked off the semester by running through a syllabus and explaining how they’d calculate your grade. Dr. Perlis, instead, started with an assertion.
“Programming,” he said, “is the purest form of poetry.”
Curious to know what he meant by that, I returned for the next class.
Programming wasn’t new to me. When I was in high school, my mom bought an Apple II Plus — as characteristically ahead of her time as when she began baking her own granola — and launched a data-centric consulting business from our home.
Her first client was a family friend who was an editor at Weight Watchers magazine: my mom would type Weight Watchers recipes into a database program called DB Master, and when the friend needed a recipe with, say, chicken and fewer than 500 calories, she would call us. Once, when my parents went on vacation, my mom showed me how to run the queries so I could answer the phone, and before long I was fooling around with Applesoft BASIC.
But the idea of majoring in computer science in the mid-1980s? Not something you were supposed to do at a liberal arts college. By that time, plenty of universities had computer science departments. Still, there was a stigma. If you were going to be a programmer, why not transfer to a trade school?
Dr. Perlis’s assertion about poetry challenged all that. Of course, whether you agree with it depends partly on your definition of poetry. During the next class, Dr. Perlis shared his.
“Poetry,” he said, “is the art of deriving maximum power and meaning from words. That’s what a beautiful program does.”
Anyone who’s done even a little programming knows what he’s talking about.
Dr. Perlis bolstered his case by insisting that students code homework assignments in a programming language called APL. To grasp APL’s cryptic aesthetic, consider this program for finding occurrences of a string, A, within another string, B:
With APL, all the operators are Greek letters and special symbols. Talk about maximizing meaning-to-character ratio!
Dr. Perlis loved sharing APL “idioms.” These were concise, cleverly constructed code snippets for accomplishing common tasks, which you could link together to achieve more complex functionality. For example, here’s an idiom for removing leading blanks from a string:
So: powerful bits of meaning that can be combined to build layers of complexity. And lots of power from very few words. It sounded like the purest form of poetry to me. And what could be a more liberal art than exploring meaning itself? Time to change majors.
No (But I’m Still Glad I Studied It).
Now that I’ve got a little more life experience — OK, a lot more —which actually includes reading some poetry, I’m pretty sure that Dr. Perlis was simply trying to be provocative. Poetry is an art form that conveys not just meaning, but also emotion. You can’t express emotion through code. (Well, someone could probably write a good poem made solely of elements found in code, but that’s not really programming.)
But the more important reason I’m glad to have majored in computer science relates to something else Dr. Perlis said during that first class. He said it right after the poetry thing:
“Think about the greatest, most beautiful cathedrals in Europe. Some of them took more than 500 years to build. Can you imagine the grandeur and scope of the computer programs we will build over the next 500 years?”
At the time, all I could imagine was one, generations-spanning team working on a single code base. But over the years, I’ve come to think of the entire Web (which didn’t exist when I met Dr. Perlis) and all of our API-enabled, interconnected systems as the “cathedral” —a single grand structure we’re all building together. I haven’t made my living as a coder for quite a while, but it’s nice to go through life with a working knowledge of that structure.
I lost touch with Dr. Perlis after graduation; he died in 1990. I learned from his Wikipedia entry that he was famous for provocative sayings like the ones he uttered in our class. Some were silly puns, while others were more profound:
“A language that doesn’t affect the way you think about programming is not worth knowing.”
If you’d like to see more, Yale’s computer science department still hosts them on a page titled Perlisisms: Epigrams in Programming.
After I published this, Dan Gackle (dang on Hacker News) posted a link to a document I’d never seen before, In Praise of APL: A Lyrical Programming Language, in which Dr. Perlis explains his approach to introductory computer science classes. He describes his intention to deliver a “pou sto to last the student for 40 years, not a handbook for tomorrow’s employment,” which he absolutely did. (Every time I’ve encountered a new language or framework — Java, Ruby, Rails, whatever — I’ve been grateful to him.) He also advises that computer science students should be “on the computer early and often.” I didn’t get much sleep that semester — now I see that was by design.