Processing: This is how you make designers addicted to coding [Pirates of the JVM]

It’s time for another stop — our Pirates of the JVM journey is taking us to the island of Processing, not far away from our previous stop, Fantom, in the waters of the Static Sea. We talked to Ben Fry about the advantages and disadvantages of this language, its core principles and more.

Ben Fry is giving our Pirates of the JVM series that je ne sais quoi in terms of style and aesthetics. No wonder he received his doctoral degree from the Aesthetics + Computation Group at the MIT Media Laboratory, where his research focused on combining fields such as computer science, statistics, graphic design, and data visualization as a means for understanding information.

It’s been 16 years since this programming language started to promote software literacy within the visual arts and visual literacy within technology. According to the official website, these are the key benefits of Processing:

Free to download and open source

Interactive programs with 2D, 3D or PDF output

OpenGL integration for accelerated 2D and 3D

For GNU/Linux, Mac OS X, Windows, Android, and ARM

Over 100 libraries extend the core software

Click on the map to see the entire infographic

Let’s allow Ben Fry to tell you all about Processing.

Processing — Background information

JAXenter: What was your motivation for working with Processing? What does Processing have to offer that other languages fail to provide?

Ben Fry: We set out to make something that was:

• A sketchbook for our own work, simplifying the majority of tasks that we undertake,

• A teaching environment for that kind of process, and

• A point of transition to more complicated or difficult languages like full-blown Java or C++ (a gateway drug to more geekier and more difficult things)

At the intersection of these points is a tradeoff between speed and simplicity of use. i.e. if we didn’t care about speed, Python, Ruby or many other scripting languages would make far more sense (especially for the simplicity and education aspect of it). If we didn’t care about the transition to more advanced languages, we’d get rid of the C-style (well, Algol, really) syntax. etc etc.

Java makes a nice starting point for a sketching language because it’s far more forgiving than C++ and also allows users to export sketches for distribution across many different platforms. When we got started in 2001, most people were using it to build applets that ran on the web, which was important to the early growth of the project. Nowadays we still export, but it’s application bundles that run on Mac, Windows, and Linux platforms.

Processing is not intended as the ultimate environment or language (in fact, the language is just Java, but with a new graphics and utility API along with some simplifications). Fundamentally, Processing just assembles our experience in building things and trying to simplify the parts that we felt should be easier.

“Java makes a nice starting point for a sketching language because it’s far more forgiving than C++”

JAXenter: Can you describe the core principles of the language?

Ben Fry: The main idea is to put the “good stuff” at the front, to get people moving. We want people to experiment quickly, and then get into more advanced concepts (classes, objects, threading) once they’ve been able to build things. We call a project a “sketch,” because we want to get people thinking about short pieces of code that do something useful and have them feel comfortable with throwing it away and starting fresh. This is a little upside-down from most software engineering, where people are taught to think about structure first, then code into it. For people getting started with coding, it’s helpful for them to not get bogged down in the details before they’ve been able to do anything. For people who are familiar with code, it’s important for them to be able to work quickly.

Brevity and simplicity of the API is also a goal: we wanted an API that mostly fits on a page, and comfortably inside a person’s head. To give lines an 8-point width, the command is “strokeWeight(8)”, in contrast to Java2D’s requirement of setting up new BasicStroke() objects and so on.

JAXenter: What would a typical program with Processing look like?

Ben Fry: So a typical “Hello World” is more like drawing a line:

line(20, 20, 80, 80);

Just a single line of code—no threading, no double-buffering, no “new BasicStroke()”. Just write something, hit the ‘Run’ button, and see it show up.

But to make that line move and follow the mouse, that becomes:

void draw() {
line(width/2, height/2, mouseX, mouseY);
}

Or to do the same thing, but running full screen with OpenGL graphics:

JAXenter: For what kind of applications/use cases is Processing well-suited? For which ones it is not?

Ben Fry: We use it professionally for looking at large data sets and making sense of them at Fathom (www.fathom.info). Sometimes those applications are then ported to JavaScript, but only after we’ve figured out what we want to do with the data.

We try to focus on the idea of making it feel as simple as scripting but still as performant as a full-blown language.

What’s next for Processing

JAXenter: What is the current state of the language?

Ben Fry: We’re mid-cycle with our 3.x release.

JAXenter: How about your plans for Processing?

Ben Fry: We’ve been supporting many variants more recently: p5.js re-imagines how this is done in the context of JavaScript with the web as a platform. We have a Jython version for people who prefer Python syntax. This summer, we also have a Google Summer of Code student making a version for C Python. We have another even porting to a version of R that runs on top of the JVM.

We like working with different languages because they’re like different materials: sometimes you want a pen, other times a pencil, and maybe someone else wants to use a crayon. They all have different places they’re useful.

JAXenter: How can people interested in Processing get started?

Ben Fry: Visit processing.org/download to grab a copy. Run the application, and then select File > Examples. That’ll open a window to the hundreds of examples we’ve included with the software. Then check out all the Libraries people have developed for it, which extend things in all kinds of amazing ways: https://processing.org/reference/libraries/

Ben Fry is principal of Fathom, a design and software consultancy located in Boston. He received his doctoral degree from the Aesthetics + Computation Group at the MIT Media Laboratory, where his research focused on combining fields such as computer science, statistics, graphic design, and data visualization as a means for understanding information. After completing his thesis, he spent time developing tools for visualization of genetic data as a postdoc with Eric Lander at the Eli & Edythe L. Broad Insitute of MIT & Harvard. During the 2006-2007 school year, Ben was the Nierenberg Chair of Design for the Carnegie Mellon School of Design. At the end of 2007, he finished writing Visualizing Data for O’Reilly. In 2011, he won the National Design Award for Interaction Design from the Cooper-Hewitt.

Pirates of the JVM — The series:

Are you familiar with all the programming languages from the JVM universe? Have you discovered them all?

If the answer is “no”, we’ll leave no stone unturned in the search for knowledge. Therefore, the Pirates of the JVM infographic is accompanied by a series of articles in which we put the spotlight on the languages you may or may not know.