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:

import java.awt.Color;

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[0];
String green1 = args[1];
String blue1 = args[2];
String red2 = args[3];
String green2 = args[4];
String blue2 = args[5];
String red3 = args[6];
String green3 = args[7];
String blue3 = args[8];

//convert RGB values into color variables
int redVal1 = Integer.parseInt(args[0]);
int greenVal1 = Integer.parseInt(args[1]);
int blueVal1 = Integer.parseInt(args[2]);
int redVal2 = Integer.parseInt(args[3]);
int greenVal2 = Integer.parseInt(args[4]);
int blueVal2 = Integer.parseInt(args[5]);
int redVal3 = Integer.parseInt(args[6]);
int greenVal3 = Integer.parseInt(args[7]);
int blueVal3 = Integer.parseInt(args[8]);

//available colors

Color color1 = new Color (redVal1, greenVal1, blueVal1);
Color color2 = new Color (redVal2, greenVal2, blueVal2);
Color color3 = new Color (redVal3, greenVal3, blueVal3);

StdDraw.setCanvasSize (800,800);

//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.


Leave a comment

Filed under Exactitude

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s