24 Jul 2000
(updated 1 Nov 2001 at 13:24 UTC) »
Drinking and Debugging
So I banged out a Perl-Tk program to wrap ipgrab and display
its output as a call-flow diagram. It took about three days
because I was over-zealous about parsing the SIP and SDP
messages, and I made my usual stubborn mistake of writing
the whole thing before debugging any of it. Anyway, it
was still having some bugs at the Friday afternoon deadline.
I was most frustrated.
I felt a little burned out, so I went to the liquor store
with Mike and we played Beer Pong. This entails placing
an open beer on the ping-pong table in front of you, then
playing as normal, except that a hit to your opponent's
bottle or can (except on a serve) results in a one-drink
penalty for him. Losing a point also brings a
one-drink penalty. Hence it is possible to make your
opponent drink twice with (e.g.) a shot that hits her
side of the table, bounces once, hits her beer, and caroms
off the table before she can return it.
In this manner Mike and I got uproariously drunk. Then,
around 12:30 a.m., I returned to debugging. To my
amazement, I found three bugs in deeply nested
code and nailed them in about 40 minutes, bringing the
program up to the milestone requirements. I hung around
reading till I sobered up, then drove home victorious.
The moral of this story, I suppose, is that sometimes being
able to hold the whole program in your head is a bad thing.
Just as when you edit your own writing, your vision is
obstructed by your mental image of your work; you see what
you thought, not what you wrote. A little chemically
induced impairment can hobble your brain enough that
you see only the code in front of you, bugs and all.
Friends don't let friends drink and drive, but you might
just say yes to coding drunk. :)