Agents and Arays

Today we have been working on Object-Oriented Programming in relation to Classes. Oracle describe classes as …

“A class is a blueprint or prototype from which objects are created. This section defines a class that models the state and behaviour of a real-world object. It intentionally focuses on the basics, showing how even a simple class can cleanly model state and behaviour.”

From what I understand a class is like setting out a framework for and object. This means that this can be called at any time into the main document. This saves a lot of repetition of code when creating large programs which use classes within classes which can be referred to as super classes.

This is a class for an object called Agent, which creates a simple box with an additional method (which can be added if specified) that adds 3 pixels on the x. Methods can also be added with the class and retrieved in relation to the class


This is the main document explained further with code comments describing what each instance does and its effect.


documentFrom this exercise I have gained a considerable amount of knowledge about classes and how they can be use to lighten a complex code systems. It has taught me how to implement Object-Oriented Programming in my work and the advantages this can have upon the readability of the code itself.

void ray() {
for (int i = 0; i < 6; i = i+1) {
if (mousePressed){
float c = 0;
float b = random(100,255);
float s = random(6,12);
triangle(c, c, c-22*s, c-17*s, c-20*s,c-19.2*s);

I have taken this and when working on a processing sketch used it to speed up a loop process. I did it like this because it reduced the amount of operation each loop had to do. This gave a far greater frame rate to the sketch making the images flow better and not be restricted by bad code.

Object-Oriented Programming Concepts – Oracle

Leave a Reply