Object-Oriented Programming in Processing
Thus far in the book the majority of the code examples have been procedurally structured—relying on only variables and functions. Behind the scenes, through Processing’s relationship to Java, Processing is object-oriented through and through. Though it is theoretically possible to avoid utilizing object-oriented syntax and structures when programming in Processing, it wouldn’t be an especially sensible way to proceed as you build more sophisticated sketches. That being said, Processing was also not designed for industrial-grade, object-oriented development (though there are ways of using it for that as well). Confused? In this chapter I’ll attempt to sort out some of these issues, as I ease you into OOP in Processing. Because of the wide range of readers’ coding experiences, I’ll take somewhat of a middle path in how I present OOP: I won’t include a comprehensive introduction to OOP theory, though I will include some; nor will I go too deeply into advanced OOP concepts (but again I’ll cover some of it). My main purpose here is to quickly get you up and coding with OOP in Processing and to also include a comparison between Processing and ActionScript’s OOP approaches. For those of you completely new to OOP, it may be helpful to review some preliminary material. Processing: Creative Coding and Computational Art includes a comprehensive introduction to OOP in Processing, as do Processing: A Programming Handbook for Visual Designers and Artists, by Casey Reas and Ben Fry (MIT Press, 2007) and Learning Processing: A Beginner’s Guide to Programming Images, Animation, and Interaction, by Daniel Shiffman (Morgan Kaufmann, 2008).
KeywordsExpense Sine Hunt Suffix
Unable to display preview. Download preview PDF.