TITLE: Today I Wrote a Program
AUTHOR: Eugene Wallingford
DATE: October 06, 2007 8:16 PM
DESC:
-----
BODY:
Today I wrote a program, just for fun. I wrote a solution
to the classic
WordLadder
game, which is a common
nifty assignment
used in the introductory Data Structures course. I had
never assigned it in one of my courses and had never had
any other reason to solve it. But my daughter came home
yesterday with a math assignment that included a few of
these problems, such as converting "heart" to "spade",
and in the course of talking with her I ended up doing a
few of the WordLadder problems on my own. I'm a hopeless
puzzle junkie.
Some days, an almost irrational desire to write a program
comes over me, and last night's fun made me think, "I
wonder how I might do this in code?" So I used a few
spare minutes throughout today to implement one of my
ideas from last night -- a simple breadth-first search
that finds all of the shortest solutions in a particular
dictionary.
A few of those spare minutes came at the public library,
while the same daughter was participating in a writers'
workshop for youth. As I listened to their discussion
of a couple of poems written by kids in the workshop in
the background, I thought to myself, "I'm writing here,
too." But then it occurred to me that the kids in the
workshop wouldn't call what I was doing "writing". Nor
would their workshop leader or most people that we call
"writers". Nor would most computer scientists, not
without the rest of the phrase: "writing a program".
Granted, I wasn't writing a poem. But I was exploring an
idea that had come into my mind, one that drove forward.
I wasn't sure what sort of program I would end up, and
arrived at the answer only after having gone down a couple
of expected paths and found them wanting. My stanzas, er,
subprocedures, developed over time. One grew and shrank,
changed name, and ultimately became much simpler and clearer
than what I had in mind when I started.
I was telling a story as much as I was solving a problem.
When I finished, I had a program that communicates to my
daughter an idea I described only sketchily last night.
The names of my variables and procedures tell the story,
even without looking at too much of their detail. I was
writing as a way to think, to find out what I really
thought last night.
Today I wrote a program, and it was fun.
-----