Thursday, January 28, 2016

Poetry and Programming

Most people do not associate poetry with computer programming. Yet on a fundamental level, poetry and programming actually have many similarities...

  1. Brevity. The best poems and computer codes are concise and use the fewest words or symbols. The best poems are those that have many interpretations contained within a short arrangement of words. Similarly, the best programs are the efficient ones that can complete a task with the fewest lines possible.

  1. Word choice. Every symbol and word has a purpose in both poems and computer code. Every word in a poem has a meaning, and the author chose every single word for an important reason. In the same way, every symbol in a computer program has a reason for being there. No programmer leaves extra words or characters cluttering up the code.

  1. Hard to understand by skimming. The meaning of both a poem and a computer code is not clear after just a quick glance. You cannot understand the full meaning and all the nuances of a poem by just skimming it in a few minutes. You have to sit down, analyze it, and think about each line's purpose. The same is true of a computer code. If one programmer tries reading someone else’s uncommented code, they would find it almost impossible to make sense of without careful reading and analysis.

  1. Repetition. In many poems, repetition is key. Whether it is repeating the same first line in a verse, repeating a word or phrase two or three times for emphasis, or just repeating the same theme throughout the poem. In computer programming, the fundamental basis of almost every code is loops, which allow programmers to repeat a section of the code as many times as the programmer wants. Both poems and code would lose meaning without constant repetition.

Below are some simple programs that can be read in haiku form. The first represents the basic syntax of a for loop in Java. The second is a basic program in c++ that outputs the text “Hello world.” The third is a similar basic text-output program in Java.

for( int x = 10; x > 2; x--)

For int x is 10
x strictly greater than 2
x decrease by 1

-------------------------------------------------------------------------------------------

#include <iostream>
int main()
{
      cout << "Hello World!";
}


Include iostream
Int main no parameters
C-out hello world
-------------------------------------------------------------------------------------------

public class program
{
public static void main(String[] args)
{
System.out.print(“Hi!”)
    }
}

Public class program
public static void main args
System out print Hi!

Tuesday, January 19, 2016

Should a poem fit in a box? (Problem 1)

Alright, well first, did you really try? Did you fold it neatly? Did you try to crumple it up first? Did you really shove it in? Yes? Okay. Did you try to find a bigger box? Did you pull apart the poem, line by line, to see if it fit then? Did you really, really try? Yes? Hmm. Okay.

This might be one of those poems. The ones that boxes just can’t contain. Sometimes poems are like people. They don’t fit into tiny cardboard boxes like we want them to. They spill over the sides, into other boxes, or maybe into none at all. And that’s okay.

Sometimes when a poem doesn’t fit in a box, it’s scary. Like when a person doesn’t fit into just one box. We want poems, like people, to fit into one box and one box only. Prose, rhyme, haiku, sonnet, modern. But what if as the author was painting their poetry to life they dipped their paintbrush into more than one color of poem. A bit of blue, haiku, a bit of purple, modern, and then an accent of yellow, rhyme. They all come together to make one poem. A poem that, yes, doesn’t fit into a box.

Boxes are overrated. Imagine if the boxes we checked defined us; female, male, straight, gay, black, white, child, adult. We are more than the boxes we are put in. Poems are too.