Saturday, February 26, 2011

Code poetry

NOTE: I had originally posted this a couple of years ago and then took it down because I thought I might include it in my book "I'm Feeling Lucky" (henceforth abbreviated as IFL). It didn't make the final cut so I'm releasing it again into the wild. -Doug

The receptionists at Google always seemed overqualified for the tasks they were given. They smiled and pointed guests to the cooler full of free Naked Juice, explained how the massage chairs in the lobby worked, dialed the extension of the person being called upon and then consoled the visitor for half an hour or so until the Googler in question showed up. One result was that when given the opportunity to express themselves in more intellectually stimulating ways, they did so.

I think it was Deb who started emailing notices of lost and found objects in verse. One evening, this message arrived in inboxes across the network:

It was all alone, this sweet little phone,
And it went by the name of Verizon.
Silver and light, respond to its plight!
Please retrieve it at Bayshore Reception.

In a whiff and flutter, the scarf was a-hover,
And lost its way on one googly afternoon.
It's chenille, true -- and if this sounds like you,
Come retrieve it in the Bayshore Reception room.

Wei Hwa, an engineer and four-time winner of the World Puzzle Championship, responded in kind:

On a day such as this, one so merely mundane,
came a double epistle with a common refrain.
Assorted lost items with no one to claim,
inspiring lines that'd put Byron to shame.

Ranging from sane to the slightly absurd,
A motley of rhymes -- nay, a true smorgasbord;
The vocals! The echoes! The choice of a word --
but I think that the truth is: you're just awfully bored.

By the time I saw Wei-Hwa’s note it was after 10PM. As usual, I was logged into Google’s VPN from home, working on some project or other that was launching in the morning. I couldn’t resist sending this message:

TIME = -1

GET FILE(SYSIN) LIST(NUM):

N=0

DO CNT=1 TO NUM:

GET FILE(SYSIN) LIST(ROW,COL,TIME(ROW,COL));

IF COL>N THEN

N=COL;

END;

DO ROW=1 TO N;

DO COL=ROW TO N;

IF TIME(ROW,COL)>=0 THEN

ES(COL)=MAX(ES(COL),ES(ROW)+TIME(ROW,COL));

END;

END;

PUT FILE(SYSPRINT) SKIP EDIT('CRITICAL PATH ACTIVITIES')(A);

If engineers get to write poetry, English majors get to write code.
Btw, our own esteemed Peter J. Norvig gave me an A- on this assignment when he was a grader for my CS 50 class. Oh, what might have been...

Within seconds a dozen Googlers, including our CEO Eric Schmidt, emailed me to critique my code, ask what dust heap I had found it in and apprise me that no living coder on the planet still used this programming language. My favorite response came from Meng, an engineer, who simply noted:

Good tight loops,
Assignments look fine.
Logic flows well,
Correct every line.


Not too bad,
For English major.
Sadly, my friend,
Bart codes better.

Bart was head of our advertising operations group and not particularly known for his coding prowess.

The night in question was not extraordinary by Google standards. You could always count on reaching the people you needed when you needed them. And when you did reach them, they usually had pretty interesting things to say.

No comments: