04.04.2013 Views

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The <strong>Processing</strong> window is divided into horizontal b<strong>and</strong>s of varying height. I’ll deal with<br />

each, from the bottom up.<br />

The line number, at the very bottom of the window, shows you what line of code you are<br />

currently working on, based on your cursor position.<br />

The text area gives you verbose feedback about bugs in your code. It can be scary <strong>and</strong><br />

frustrating to new coders to see all these errors come up in the text area when they first<br />

begin coding; rest assured, it happens to all of us. New coders often struggle to even find<br />

the errors in their code, <strong>and</strong> it can seem impossible that a typo or logic error could still<br />

possibly exist in code you’ve painstakingly gone through numerous times. The errors will<br />

likely also seem annoyingly cryptic, but over time you’ll learn to underst<strong>and</strong> the messages<br />

<strong>and</strong> more quickly track down your bugs. However, there are times when even experienced<br />

coders struggle to eradicate bugs. I usually find taking a break helps (as well as screaming<br />

obscenities at the top of my lungs). Eventually, you’ll appreciate these verbose error messages<br />

<strong>and</strong> see how valuable they are in the debugging process. <strong>Processing</strong> also includes<br />

two comm<strong>and</strong>s, print() <strong>and</strong> println(), that allow you to output information about your<br />

sketch to the text area.<br />

The message area gives you quick feedback during saving <strong>and</strong> exporting, <strong>and</strong> tells you in<br />

plain, simple language about errors in your code.<br />

The text editor is where you write your sketch code; it’s essentially your old text editor. If<br />

you play with it, you’ll notice that there are clear feedback color cues, showing you what<br />

line your cursor is on, what text is selected, <strong>and</strong> if a word you typed is a legal keyword in<br />

the language.<br />

The tabs show you what files you are working with. Tabs are really h<strong>and</strong>y when your sketch<br />

requires multiple files. At the right side of the tabs area is a right-facing arrow button.<br />

Pressing this button opens a pop-up menu that allows you to create <strong>and</strong> manage your<br />

tabs. When you open an existing sketch in <strong>Processing</strong>, any Java or PDE files in your sketch<br />

directory will be automatically put into the tabs layout. The benefit of this will become<br />

clearer when you begin to work with external functions <strong>and</strong> classes. By default, there will<br />

always be at least one tab open, with its name at the bottom of the tab pop-up menu. This<br />

tab will be your current main sketch PDE file (it’s called a PDE file because .pde is just the<br />

suffix that <strong>Processing</strong> sketches use—it st<strong>and</strong>s for “<strong>Processing</strong> development environment”).<br />

As more tabs are created, you’ll see the new tab names at the bottom of the tabs pop-up<br />

menu as well. You can select one of these names by clicking on it to give the tab focus<br />

(make it the active window) in the <strong>Processing</strong> project window. When you click on the tabs<br />

arrow button, the pop-up menu allows you to do the following:<br />

Create a new tab<br />

Rename a tab<br />

Delete a tab<br />

Hide/unhide a tab<br />

Move focus to the previous/next tab<br />

THE PROCESSING ENVIRONMENT<br />

147<br />

5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!