Computer coding – summary and analysis

Standard

In the past 3 weeks we have explored how algorithms and computation impacts art. Week 5 introduced us to the world of Processing. Processing is a type of programming language that is open source and an integrated part of computation art. Our task was to create an image using pseudo-code and understand key concepts and elements that go into making a code. These steps being: objects, properties, methods (or functions), method parameters, loops, loops within loops, the program entry point, and its exit point.

Understanding the basic functions of Processing it was time to put our knowledge into practice. Given the exercise of:

  1. Find out how to create different shapes and lines (e.g. square, circles, rectangles, triangles, eclipses etc.) and the different properties (fill, colour, dimensions etc.) by looking up the Processing Reference (http://www.processing.org/reference/) and Tutorials (http://www.processing.org/tutorials/).
  2. Find out how to fill the shapes/ change colour.
  3. Choose one of the artworks below and create it in Processing.
    1. Bridget Riley’s Encircling Discs with Black.
    2. Piet Mondrian’s Composition in Red, Blue and Yellow
    3. Kazimer Malevich’s Self-portrait in Two Dimensions
    4. Damien Hirst’s Controlled Substances

Choosing Piet Mondrian’s Composition in Red, Blue and Yellow we ended up with:
squares

Though this was the first exercise we came across, there are principles of coding that we need to take into account. These Principles being:

  1. Don’t Repeat Yourself (DRY) – code should have a singular representation
  2. Test as you write – deals with efficiency in the long-run
  3. Reduce dependencies as much as possible – specify specific connections so chunks of code aren’t largely dependable
  4. Validate your data – being able to not break down when fed “garbage” data
  5. Handle errors nicely – give a reason when an error has occurred
  6. Keep it simple – so it is easy to construct and maintain
  7. Tidy up after yourself – when an error/bug occurs fix it, don’t leave it for another time
  8. Learn new tools
  9. Maintain your flow
  10. Make your code unsurprising
  11. Don’t program by coincidence
  12. Code entopy

(source – http://www.hurricanesoftwares.com/most-important-coding-principles/)

Week 6 was specific to the idea of how loops effect codes and what can be changed so drastically through minimizing the code. Using the “for” command which related to repetitions, iterations and loops we simplified the code and made it easier to use. Using a compressed picture and showing how the “for” command works we get the following images:

Pikachu Random(count x row x 51) Pikachu background change Pikachu shade black to whiteThe only line of code that was changed was “tint” in each code.

“Tint” is a lexicon of the processing language. “Lexicon” is defined as – the vocabulary of a person, language, or branch of knowledge. Regarding Processing – processing is the language and the popular lexicons would be: size, fill, for, if, int, void, ellipse, rect, loop, float and tint.

Week 8 was about slit-scanning. This exercise was to explore the aesthetic dictated by slit-scanning. The exercise was to record a short video and insert it into the following code:

import processing.video.*;
Movie mov;
void setup() {
  size(950, 540);
  mov = new Movie(this, "/Users/kathgadd/Desktop/sample_code/bikePathed.mov");
  mov.loop();
}
// Display values from movie
int slitPosition = 0;
void draw() {
  loadPixels();
  if (mov.available() == true) {
    mov.read();
    mov.loadPixels();
    for (int j = 0; j < height; j++) {
        // copy the slit from movie into one column of screen image
        pixels[ (width * j) + slitPosition  ] =  mov.get(slitPosition, j);
    }
    slitPosition++; // move head across one column
    if ( slitPosition == width ) { noLoop(); } // make sure we stop at the end of the image!
  }
  updatePixels();

slit scanning 3

slit scanning codeslit scanning 2

Slit-scanning 1

By changing the parts of the code we can change the speed of the slit, when the slit occurs and even the repetition of the slit.

The artistic style of slit-scanning has been popularized by artist Daniel Crooks with his piece “Static No. 12”.

Object-orientated programming (OOP) approach is when values and statements are packaged into objects. Object-orientated approach “shifts the emphasis from passive elements acted on by statements to active elements, the object, interacting with their environment”. OOP lets you write a set of functions, then expand them in different direction without changing or copying them in any way

(source: http://www.cmi.univ-mrs.fr/~piar/REPORTS/CMI_M2_EDP_CS2.pdf)

Procedural and object orientated approachProcedural programming approach is when code is organized into small procedures that take some input, do something and then data comes out. The functions/procedures have no intrinsic relationship with the data used. Procedural program is used when needing specify the steps the program must take to reach the desired state.

(source: http://objectorientedcoldfusion.org/procedural-vs-object-oriented.html)

Advertisements

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s