Saturday, November 21, 2009

From 4 To 5

There's always been a periodic something, throughout my whole career, about that last hour of the workday. I experienced it twice this week, for the first time in quite a while. It's something you'll probably understand, if your labor is more mental than physical, as mine is when I'm deep into a programming task.

I literally cannot count the number of times that I've opened my work day optimistically, just knowing that I've picked apart a knotty bit of logic and that I was going to dazzle myself and my fellow developers. Almost every time, I would have been better following the old saw about being a pessimist -- you're pleasantly surprised when things turn out well.

Programming is described by Fred Brooks, the project manager behind IBM's OS/360 and the author of The Mythical Man-Month, as the discipline of building things out of pure thought stuff. This means that there's no limit on the raw material needed for the job. It means as well that there are hundreds, if not thousands, of ways to do any particular task, and even more ways to it wrong.

Programming is an exacting discipline. Computers make no assumptions, provide no defaults. This means that developers must supply all the details in every layer, from the bare metal and plastic and silicon to the operating system to the network to the database to the web page in the browser.

It's those little details that trip me up: the need to specify an absolute path to the directory where I want to write a file rather than a relative path from the web page I'm programming; drilling down to the exact property of an object to get the value I want to work with rather than stopping at too high a level; forgetting a period or a semi-colon (depending on the punctuation a programming language demands) and thereby blowing the scope of a conditional statement.

These are just a sampling of the reasons that programming, testing, and debugging are still more art than science.

So after the optimistic start to a day writing computer code gets shot and left dying in the dust, after frustrating hours of echoing obscenities in my head, how is it that in that last hour of the workday, my subconscious mind is liable to offer up a solution? Not only a solution, but one that is usually not only workable, but even elegant?

I rather hope this remains a question whose answer eludes me. Otherwise, I'm afraid I'll have graduated from craft to engineering, and I'll feel more like a cog in a wheel than a mystic.