Saturday, September 12, 2009

Thoughts on Processing for the Web

Mozilla's Processing for the Web aims to leverage's low learning curve and expressiveness, but abandon the JVM dependency.  This is probably for the best as Processing is a great learning and experimentation environment, but applets are still clunky today well over ten years since they were introduced.

My personal felling is that processing's Java roots hinder it slightly in the learning curve department due to its static typing system.  Collections are particularly messy since processing doesn't do parameterized types, so you end up with lots of explicit casting if you're doing anything interesting at all.  JavaScript is much more lax in this regard and has language-level associative array support.  I know my own sketches would be much easier to work with in JS than in the current Java based Processing language because of this.  I create lots of classes to represent objects in my sketches and it's a pain to stuff them into and cast them back out of java.util.ArrayList and java.util.HashMap.

I met John Resig (author of jQuery and processing.js) when he came to speak at Google about JavaScript performance several months back.  I mentioned my backport of processing.js to processing to him, and he chuckled and said something to the effect of "Yeah, processing wasn't ready for the web."

It really wasn't, but I'm not sure that was a mistake.

You can do some really neat things with processing, specifically hardware controller interfaces, that you can't do in a browser without some serious compromises in the browser security model.  It would be a shame if Processing for the Web drew all the attention and developer resources away from the original Processing, but I doubt that will happen (soon, if ever).  P4Web will probably bring in new developers who wouldn't have touched the original Processing in the first place.

What I would like to see from this development is an evolution of the (JVM based) Processing language itself to be more JavaScripty. Perhaps P4Web will help nudge it in that direction.