This is an HTML rendering of a working paper draft that led to a publication. The publication should always be cited in preference to this draft using the following reference:
Casey Read and Ben Fry
Processing: A Programming Handbook for Visual Designers and Artists
Cambridge, MA: MIT Press, 2007
How can artists and graphic designers approach programming? The steep learning curve of working with a general purpose programming language can be a real passion killer. The “Processing” open source programming language and environment solves this problem in a pragmatic yet elegant way. The Processing language is built as an extension of Java. It therefore benefits from Java’s mature design and large supporting ecosystem. Processing differs from Java in that one can write statements without having to enclose them in a method and a class. With a stroke this small simplification removes two big stumbling blocks for the budding artist who just wants to experiment with drawing on a computer screen. Additional features that make one’s life easier are a pre-allocated canvas and tens of simple methods tailored for drawing, sensible defaults for all values, intuitive ways for specifying colors, a simple animation model, painless array expansion and contraction, and some nifty functions for normalizing, mapping, and transforming values and shapes. Furthermore, the available facilities are tailored for graphic designers: for instance loading an image is a matter of a simple function call, while the program’s output can be easily saved as a high-quality PDF file. Not all elements of Processing are optimally designed: the representation of 2D images as one-dimensional arrays and the handling of fonts through bitmaps, are two sore points. On balance however, the power of Processing is exactly at the right level for an artist.
The Processing environment allows rapid prototyping just like the interactive Basic, Smalltalk, Turbo Pascal, and Visual Basic environments. This brings back the long lost joy of serendipitous creative programming. The environment features a window where one writes code, a console for printed output, and the canvas. Syntax highlighting, and intuitive error messages help non-experts, but won’t get in the way of a seasoned programmer. Interestingly, the code one writes in the Processing environment can then be readily exported as a regular Java applet, which can be run locally or over the web.
The book covers the language, the programming environment, and much more. It is structured like a programming textbook for beginners. However, instead of the traditional dry “hello, world” and calculate-the-average examples, each chapter uses the graphics capabilities of Processing to create visually interesting pictures. The text is easy to understand, but definitely not simplistic: it aims at clever people who want to experiment and crave for creative power. The approach is unapologetically pragmatic. The first concepts discussed are the most interesting and useful for a designer, with loops, branches, and objects introduced as late as possible. The authors clearly put a lot of thought into organizing their material in a way that will fit the needs of their students rather than slavishly following some abstract theoretical structure. For example, the humble functions floor, ceil, min, and max are discussed together as ways for constraining numbers. Chapters introducing new concepts often begin with a broad overview of the underlying technology. For instance, strings give rise to a discussion of natural language processing, fonts to digital typesetting, and video to computer vision. After reading the book and experimenting with the environment, I was intrigued by the possibility of adopting Processing as a general-purpose introduction to programming.
Interspersed with the tutorial text are larger examples, which are also available for downloading from the processing.org web site. Even more interesting are chapters presenting the work and interviews of computer graphic artists. The associated art pieces are deep and pioneering, yet the text is easy to follow and a rich source of creative ideas. The breadth of the book’s coverage is impressive, and Processing covers all areas convincingly. These include drawing with vectors and pixels, fonts, colors, keyboard and mouse input, motion and animation, image processing, file handling, simulation of biological and physical systems, 3D graphics, vision, network access, sound processing, printing, mobile devices, and interfacing with the physical world.
As one would expect, the design of the book and the associated web site is beautiful yet also functional. In fact, one can easily imagine the book leading a double life: by an artist’s keyboard in the morning and on the coffee table in the afternoon.
The technical sophistication of Processing is modest; one versed in Java can readily understand what goes behind the scenes. Yet Processing, by removing the tedium of programming with Java’s exacting encapsulation mechanisms and application programming interfaces, liberates artistic creativity. This large difference between effort and effect is the beauty of many great ideas.