Processing and Java

The big picture

Processing is all of the following:

Simple Processing programs can be written without the “overhead” of Java classes, constructors, exceptions, or events. Almost all Processing programs are written using a succinctly documented API.

The UNCA picture

Processing has been used in CSCI 182 and its predecessor CSCI 273 (ST: Processing) since the Spring 2009 semester. These courses have always been considered an appropriate prerequisite for CSCI 202.

The detailed picture

The Processing IDE has a preprocessor that transforms Processing into Java.

The preprocessor adds appropriate modifiers, such as public, to method definitions. It also makes minor source code changes such as changing Processing-style casting, int(x), to calls to Processing methods, PApplet.parseInt(x), and changing Processing-style colors, #A52A2A, to integers, 0xFFA52A2A. Most importantly, the preprocessor wraps the Processing program inside a Java class defintion.

This Java program must import and extend the PApplet class which is implemented in the jar file core.jar distributed with Processing. The PApplet has a well-documented Javadoc file that describes most of the operators of the Processing API.

Processing without its IDE

It is possible to write Processing programs using plug-ins for either Eclipse or NetBeans. Many programmers prefer these IDE’s because they make the task of writing and debugging large programs easier.

processing.js

In the first version of Processing, Processing programs could be exported as Java applets that would executate in browsers with a Java plug-in. However, in Processing 2, Processing programs are run inside browsers using a JavaScript interpreter. The program we discussed earlier is running below.