Friday 2 October 2015

A code to rhyme

"Programming is like poetry", I couldn't help but think hard on this neat remark made by a professor in my college (Rai sir) the other day. So I took it upon my-self to elaborate on this analogy.

I enjoy both programming and poetry by being a lazy observer and a lousy creator. Nevertheless, here is another one of my attempt to exercise writing as a hobby.

First and foremost, for those of you who will discredit this article on the premise that poetry comes and goes through the “Heart” unlike computer code, I have only one thing to say:

The human heart cannot comprehend words, only the brain can. So deal with it.

Speaking strictly from personal experience, poetry happens when the mood is either hopelessly off or gleefully on (more often the former than the later) while programming takes off from inspiration and/or an urge to make something. In more elusive words, an inspired mind does the same thing for a programmer as a broken heart does for poet. The context may be different but they both provide a sense of achievement and peace of mind upon completion.

One’s prowess in either of these two areas has direct proportion to experience and creativity. Experience is important from a lingual point of view. Both programming and poetry need a language, so how familiar one is with the language determines how capable the outcome is. Creativity may be termed as the ability to shape something new or different from something basic and naive. Both, words of a literal language and keywords of a programming language have limited ability unless they are put together creatively to draw a more meaningful product. What I mean is that a poem is a collection of words of a literal language and similarly a program is a collection of keywords (I know, operators and variables also.) of a programming language. And the quality of both these things depends on how much one knows (from experience) about the language and how one uses what they know (creativity).

Another similarity between these two is how their effectiveness is dependent on the reader/machine. I won’t be able to understand and hence learn from a poem written in say French, no matter how moving it may be. Similarly what good an earth shattering code in C is if my computer doesn’t have the Compiler for it (a tool to understand the language)?

While the analogy is great it doesn’t always fit. Consider this, a program needs to be in strict agreement with the rules and syntax of the programming language. A poem on the other hands can and have (many times) defied even the most fundamental grammatical rules in order to have a desired effect on the reader.

Ambiguity is an accepted and celebrated part of poetry. Programming on the other hand has a strong despise for ambiguity. A computer program relies on logic and the predictability of how the machine will react, for achieving its goals. A poem makes use of rhetorical statements and questions and lets the reader to draw their own meaning independent of one another.  This difference is very important. A computer code always means the same thing to a computer. There is no room for an alternate interpretation. This is because computers have predictable behavior (or their unpredictability is nothing compared to humans). Two humans can conceive different lesson from a poem, this is not at all true for computers and computer programs. They (computer programs) mean exactly what they state (zero sarcasm).

I can go on for a while on this, but for the sake of the reader (if there is at all any), I conclude by saying the following.

Poetry and Programming sound good in an analogy. They have remarkable similarities but at the same time they are indeed fundamentally different. But then again, ask me later, I might say something else.

PS: Check out this website http://www.sourcecodepoetry.com/