When I think of exactitude, I think about grammar and syntax. These are the foundation of every language, from natural languages, such as English and Japanese, to formal languages, such as computer programming languages. Right now, I’m taking a Java programming class. I’ve never been more exact than when I’m working on a project in Java. Unlike humans, computers take language very literally and do not interpret meaning based on context.
For example, if I were to type the sentence
i luv ice cream its gr8
you would be able to understand it perfectly, even though it’s not grammatically correct. If, however, I were to type something with similar syntactical errors into a computer program, I’d be awash in error messages. I’d have to type something more formal, like this:
I love ice cream. It’s great.
See what I mean? Fortunately, despite their inability to interpret context clues, computer languages are extraordinarily powerful. I used Java to write a program that draws Albers squares, which we learned about in Graphic Design: The New Basics.
This is what the code looks like:
public class albers
/*This program creates Albers squares. I’m an English major, and I got the
idea for this project from one of my English classes, where we’re learning about Josef Albers.
The program takes 9 command line arguments, which correspond to the RGB values for 3
separate colors. Enter the RGB values (separated by spaces) for your three colors, then run the program
to produce your Albers squares. Have fun!
Ex. java albers 255 0 0 0 0 255 0 0 0 255
will give you a square with red, green, and blue components.
A complete list of colors can be found at:
public static void main (String args)
//command line args–RGB values for 3 Albers square colors
String red1 = args;
String green1 = args;
String blue1 = args;
String red2 = args;
String green2 = args;
String blue2 = args;
String red3 = args;
String green3 = args;
String blue3 = args;
//convert RGB values into color variables
int redVal1 = Integer.parseInt(args);
int greenVal1 = Integer.parseInt(args);
int blueVal1 = Integer.parseInt(args);
int redVal2 = Integer.parseInt(args);
int greenVal2 = Integer.parseInt(args);
int blueVal2 = Integer.parseInt(args);
int redVal3 = Integer.parseInt(args);
int greenVal3 = Integer.parseInt(args);
int blueVal3 = Integer.parseInt(args);
Color color1 = new Color (redVal1, greenVal1, blueVal1);
Color color2 = new Color (redVal2, greenVal2, blueVal2);
Color color3 = new Color (redVal3, greenVal3, blueVal3);
//first Albers square
//second Albers square
To an untrained eye, it may seem very technical and abstruse, but the point is that the syntax must be flawlessly exact for the program to run.