Can computer programming be like literature?

example of Python language

example of Python language (Photo credit: Wikipedia)

Programming a computer is unlike most other vocations which are generally considered professions. Writing code is a creative process. OK, the requirements specification lays down the overall dimensions of the playpen. There might even  be some coding standards somewhere on a shelf gathering dust. But within these constraints, the coder is generally free to craft the software any way they want. There is no right or wrong answer, and yet, computer programmers can be very critical of their peers’ programming style.

Some craft their code for brevity. To them, a single deviously, crafted line of code that performs umpteen operations is the pinnacle of the art. Others code for readability. They aim for such self-evident clarity that granny should be able to read the code and have a good idea about what’s going on.

Others code for performance, eking every last cycle of performance out of their composition, often at the cost of the former two. Some code from the hip, typing code in as quick as it comes into their heads. The backspace key is the first to wear out on their keyboard. Others take a long time working out exactly how to lay out the code before they ever go near a keyboard. The actual coding takes much less time than the planning.

I used to work within a team where one of my colleagues was a Christian. No problem with that, except he was a Christian with a capital C. When he introduced himself to people for the first time, he would include his religion in his first sentence. He used to update the comments in every routine he touched to include a verse from the bible. Often, they were poignant and very reflective of the code within.

Another colleague was a Black Sabbath fan. He used to replace any such biblical verse with lyrics from his favourite heavy metal tracks. Again, many were appropriate to the code. This silent coding warfare went on for years. Who knows how much mental effort and time went into the cleansing or infestation of the comments in this way.

To the rest of us, it was something to talk about and the contrast between the two sets of comments were often hilarious. But do I think that computer programming could ever be like literature? As much as I would like to believe it could be, I’m afraid I fear the answer is no. I just can’t imagine a book full of code would ever make the bestsellers list.

Having said that, here are some of the funny comments I’ve come across in my career in IT;

Options.batchSize = 300 // madness? THIS IS SPARTA

// I am not responsible for this code
// They made me write it against my will

// Dear future me, please forgive me.
// I cannot even begin to express how sorry I am.

double penetration ; // Ouch!

// I have no idea what this code does - I only changed line 1397

# To understand recursion, see the bottom of this file

...At the bottom of the file

# To understand recursion, see the top of this file

// I'm not sure why this works, but it fixes the problem.

// Somedev1 - 6/7/2002 Added temporary tracking of logic screen
// Somedev2 - 22/5/2007 Temporary my arse!

// You may think you know what the following code does.
// But you don't - trust me
// Fiddle with me, and you'll spend many a sleepless night
// cursing the moment you thought you'd be clever enough
// to optimise the code below.
// Now close this file and go and play with something else.

// Drunk, fix later.

// Magic - don't touch!

// Not to be used in a production environment

2 comments on “Can computer programming be like literature?

  1. I do remember when I used to try to establish a parallel between poetry and coding, back at uni. Coding standards, code reviews etc. imposed by most major development organisations quickly curbed my enthusiasm later on. And yet, one can not prevent himself to see the poetry of recursion… the one chance for the mortal programmer to give a go at eternity.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s