Aesthetics of Code

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

Aesthetics of Code

Postby Missinggoat » Sat Apr 21, 2012 12:35 am UTC

"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.
Missinggoat
 
Posts: 5
Joined: Mon Apr 16, 2012 5:41 am UTC

Re: Aesthetics of Code

Postby Sagekilla » Sat Apr 21, 2012 4:15 am UTC

Beautiful code is code that you can read without wanting to stab the eyes of the person who wrote it.

No, seriously. If reading your code incites anger in me, then it is not beautiful. I should not get upset,
angry, or otherwise have feelings negative in nature while I read through code. Code this aesthetic
should be code that is enjoyable to read through.

But to really define "beautiful code" is impossible -- this is going to be different for each person.
But I think most people will agree that aesthetic code will not tun you in a ravenous axe murderer.

Don't get too caught up in "does it matter if it's beautiful?" Unless you're writing code that's going to
be publicly available for others to use and modify it really doesn't matter if it's beautiful in the long run.
Your average Joe user won't care that the source code is written in a beautifully aesthetic style. He doesn't
see this. He only sees the screen or whatever else it is that the compiled (Or interpreted) program is
doing.

Also, this comic is very appropriate for this discussion: http://abstrusegoose.com/432
http://en.wikipedia.org/wiki/DSV_Alvin#Sinking wrote:Researchers found a cheese sandwich which exhibited no visible signs of decomposition, and was in fact eaten.
Sagekilla
 
Posts: 385
Joined: Fri Aug 21, 2009 1:02 am UTC
Location: Long Island, NY

Re: Aesthetics of Code

Postby Missinggoat » Sat Apr 21, 2012 6:19 pm UTC

Haha that comic is excellent. I just found out what I'm going to be doing for the next half hour instead of reading Heidegger...

Really, I'm more concerned about the use of code as non-code. I was hoping that perhaps artistic, uncompiled code would be consistent with a useful, good application of the code, but from my research I'm beginning to think that beautiful, pragmatic code is going to be beautiful purely on the grounds of its own functionality. Ingarden says that "Even in a scientific work, literary artistic qualities can appear which determine certain aesthetically valuable qualities." However, code is something more scientific than scientific literature.

So, can code as a medium disconnected from its functional application serve as a conduit for art? It would, unfortunately have to be more abstract and deconstructionist, like Pollock or Piet Mondrian.
Missinggoat
 
Posts: 5
Joined: Mon Apr 16, 2012 5:41 am UTC

Re: Aesthetics of Code

Postby chridd » Sun Apr 22, 2012 7:06 am UTC

Missinggoat wrote:So, can code as a medium disconnected from its functional application serve as a conduit for art? It would, unfortunately have to be more abstract and deconstructionist, like Pollock or Piet Mondrian.
Have you looked at the International Obfuscated C Code Contest? There are some entries there where the code is also ASCII art; is that similar to what you're looking for?

And since you mentioned Piet, there's an esoteric programming language Piet
~ chri d. d.
mittfh wrote:I wish this post was very quotable...
User avatar
chridd
 
Posts: 361
Joined: Tue Aug 19, 2008 10:07 am UTC
Location: ...Earth, I guess?

Re: Aesthetics of Code

Postby RAKtheUndead » Sun Apr 22, 2012 8:54 am UTC

chridd wrote:
Missinggoat wrote:So, can code as a medium disconnected from its functional application serve as a conduit for art? It would, unfortunately have to be more abstract and deconstructionist, like Pollock or Piet Mondrian.
Have you looked at the International Obfuscated C Code Contest? There are some entries there where the code is also ASCII art; is that similar to what you're looking for?

And since you mentioned Piet, there's an esoteric programming language Piet


Actually, I was thinking of the IOCCC myself, but given that the OP was talking about poetry initially, I suggest he looks at Brian Westley's contest entry from 1990:

Code: Select all
char*lie;

   double time, me= !0XFACE,

   not; int rested,   get, out;

   main(ly, die) char ly, **die ;{

       signed char lotte,


dear; (char)lotte--;

   for(get= !me;; not){

   1 -  out & out ;lie;{

   char lotte, my= dear,

   **let= !!me *!not+ ++die;

       (char*)(lie=


"The gloves are OFF this time, I detest you, snot\n\0sed GEEK!");

   do {not= *lie++ & 0xF00L* !me;

   #define love (char*)lie -

   love 1s *!(not= atoi(let

   [get -me?

       (char)lotte-


(char)lotte: my- *love -
   
   'I'  -  *love -  'U' -

   'I'  -  (long)  - 4 - 'U' ])- !!
   
   (time  =out=  'a'));} while( my - dear

   && 'I'-1l  -get-  'a'); break;}}

       (char)*lie++;


(char)*lie++, (char)*lie++; hell:0, (char)*lie;

   get *out* (short)ly   -0-'R'-  get- 'a'^rested;

   do {auto*eroticism,

   that; puts(*( out

       - 'c'
   
-('P'-'S') +die+ -2 ));}while(!"you're at it");


for (*((char*)&lotte)^=

   (char)lotte; (love ly) [(char)++lotte+

   !!0xBABE];){ if ('I' -lie[ 2 +(char)lotte]){ 'I'-1l ***die; }

   else{ if ('I' * get *out* ('I'-1l **die[ 2 ])) *((char*)&lotte) -=

   '4' - ('I'-1l); not; for(get=!


get; !out; (char)*lie  &  0xD0- !not) return!!

   (char)lotte;}


(char)lotte;

   do{ not* putchar(lie [out

   *!not* !!me +(char)lotte]);

   not; for(;!'a';);}while(

       love (char*)lie);{


register this; switch( (char)lie

   [(char)lotte] -1s *!out) {

   char*les, get= 0xFF, my; case' ':

   *((char*)&lotte) += 15; !not +(char)*lie*'s';

   this +1s+ not; default: 0xF +(char*)lie;}}}

   get - !out;

   if (not--)

   goto hell;

       exit( (char)lotte);}

"The outright rejection of technology cripples the otherwise educated mind." - RAK
RAKtheUndead
 
Posts: 72
Joined: Fri Mar 27, 2009 10:18 am UTC


Return to Coding

Who is online

Users browsing this forum: No registered users and 11 guests