"What makes good code?" is a question that is often asked, and, really, can't be asked too often. But what makes beautiful code? What defines an aesthetic of code? I'm not talking about clarity, efficiency, semantics--though those things all factor into the beauty of a piece of code, I believe--rather, what makes pure, uncompiled code beautiful to look at?
There has been some discussion about "code poetry" (see http://code-poems.com/index.html), but it seems from the small amount of research I've done to be a little discussed phenomenon. Obviously, there is a good reason for this: code is a tool, and coding languages are created to serve a pragmatic function. But don't tell me you've never felt the warm fuzzies when looking at either your own code or someone else's (I have, and I've been coding only about six months). There's something legitimately beautiful about good code. But is this enjoyment a pragmatic satisfaction in the adequate solution to a problem? Is it a self-centered pride in one's own abilities? Is it a subconscious approval of humanity's achievements? Is it a weird sense of intimacy, the knowledge that I know this program; I'm speaking to the machine; I don't have any real friends and a machine is the best I can do? Is it the sense of achievement like that of reaching the summit of a mountain, or is it the view from the summit?
I'm not talking about coding "best practices", but I'm also not talking about twisting programming languages to serve our english-speaking sensibilities of poetry. I'm not talking about rhyme, enjambment, alliteration, rhythm, or even metaphor. But which of these can be transferred to the concept of code poetry. Or is code really analogous to poetry at all? Or is it more like the plastic arts? Are keystrokes the mark of the poet's pen or the painter's brush? Is the beauty of code contained in its telos (in which case uncompiled code is meaningless except as a shadow of the goal), or is there something separate from a finished product that validates incomplete, or even incorrect code as a form of self-expression or commentary on a subject? What is the subject of code poetry?
To further complicate matters, which matters more: the viewpoint of the programmer, the viewpoint of the machine, or the viewpoint of the consumer through the machine? Is the machine a lens for someone else, or is it a very particular critic? Is the purpose of code entirely to be digested by the machine and turned into something wholly different, or does the final product retain some relationship to the code behind it? If the code works, is that all that matters--does the opinion of the coder even matter (see http://xkcd.com/664/)?
As I said, I am a novice coder, as well as a novice poet. What I want to get at here is, first, the under girding principles of beauty in poetry (of which I have only the foggiest of opinions), then the application of them to computer code.
