THE PASZ.COM BLOG

Friday, September 13, 2002

Coding as an Art Form

While I'm on the topic of Stephen Wilson's book, I wanted to touch on another issue that interests me: the question of whether coding can be considered an art form.

"Programming is a combination of rigid and open processes. Certainly at some point, the concepts must be reduced to the small steps the computer can deal with. But before that point, however, there is much room for open experimentation. Also, the structuring of the small steps can itself require considerable creativity."

A function can be elegant or inventive; it can also be ugly and spaghetthi-like. But is it possible to call a piece of code "beautiful" or "artistic"? While I don't think that you're ever going to see sheets of source code hanging up in a museum, I do think the answer to this question is yes.

This being said, there are several important clarifications to point out. First, I'm talking about the code itself, not the end product -- the software program that is created by the code. It is quite possible to conceive of a very aesthetically pleasing program that was generated by ugly, sloppy code. There is a change that occurs when code is compiled, that is akin to translating a novel into another language. Code that looks great in Java may not necessarily be optimized to run well on the machine. For example, most programmers would agree that a recursive function is more elegant than a simple loop. Yet, recursive functions are generally slower on most platforms. In fact, the fastest code usually has loops that have been "unwound" (i.e. broken out step by step). It is even possible to argue that the needs of the computer are inherently non-artistic, and attempts to create art in code are at best a waste of time, and at worst liable to introduce bugs and performance problems. Perhaps the creative aspects of programming that Wilson describes, are mere concessions that we must make because we, as humans, are unable to think in pure ones and zeros. Finally, it is difficult to discuss a thing's aesthetic merits without putting it in the context of the audience. Yet most code doesn't have an audience beyond the programmer herself and her co-workers (and possibly an AI that is compiling the code?).

Despite these caveats, I think there is a benefit to thinking about programming aesthetically. I plan to delve further into this topic in future entries.

8 Comments: