10 Dec 2003
I haven’t been writing much on this site recently, because I’ve been spending most of my energy on writing software, for work and for personal projects. I’ve decided I get a lot of satisfaction from writing, both prose and programs. We talk about “writing” programs, and it’s a useful metaphor, but not entirely appropriate — writing code is a pretty fundamentally different thing from writing prose. At the broadest level, they both consist of combining arbitrary symbols according to agreed-upon rules to create a new whole. But the end product is significantly different.
And the end product of software writing is especially refreshing to me recently, for a few reasons. First, well-written code is its own proof. When you’re writing an essay or a poem, you can never know for certain when you’re done; you can’t test to see that it works, that it achieved the desired effect. Writing code, on the other hand, provides a satisfying sense of completion. You can’t argue with running code.
Of course, running code may be provably complete, but that doesn’t mean it’s beautiful. Identifying beauty in a piece of code is more esoteric and inexact than merely testing for completeness. There are a hundred ugly hacks for every beautiful solution.
But when you manage to achieve both technical and aesthetic satisfaction, it’s really something. A beautifully conceived, elegantly implemented algorithm is the perfect product of disciplined thought; it is the concrete form of clear thinking. A well-written program precisely conforms to the shape of its problem space, the way a key fits the shape of a lock, no more and no less. And you see it, and it is good.
I suppose the dual satisfaction, from the utility and the aesthetic balance of a creation, happens in lots of engineering disciplines. But I suspect that it’s more common in writing software, because computers provide something close to a perfectly closed world: everything is malliable, every state is discrete, every object is abstract (at least until you run out of RAM, which happened on a project this morning). Come to think of it, that’s probably the same reason that mathematics is satisfying, at least for those who are able to reach a level where they can be creative with math. (Which, Lord knows, I haven’t reached.)