Archive for May, 2011

BYOB 3.1 - Prototypal Inheritance for Scratch

Monday, May 30th, 2011

sicpDo you believe in OOP? Sometimes object oriented programming seems to boil down to a religious faith, even to the point where any indication of failure gets countered by dogmas about real OOP, and how just this isn’t. One such dogma holds that a program must incarnate the trinity of inheritance, polymorphism and encapsulation to qualify as real OOP.

Scratch is about controlling sprites with blocks. Since user interaction with both is quasi-physical, regarding them as objects isn’t all that far fetched to begin with.

Except, you can do funny things with computer objects that defy the laws of the physical world. Like, having the same object be present at a dozen different locations all at once through variables. Or like cloning stuff. These things aren’t rocket science, they’re plain old magic. Rather useful, too. In fact, if it weren’t for magic why bother with computers at all?

Still, magic is kinda hard getting used to for novices. I suspect that’s the reason why  Scratch doesn’t support such preternatural phenomena out the box. first class blocks? Nope. Storing sprites in variables? Not in Scratch. Propagate a costume change to all clones? Negative.

Scratch also is about walls. Sure, they’re “wide”, the threshold is “low” and the ceiling is “high”. But remember, the difference between a palace and a prison cell is merely a matter of perspective, if the design is to keep you inside. Magic this isn’t.

A few days ago Brian Harvey and I released BYOB 3.1, adding first-class sprites, a generalized object interface and prototypal inheritance. Plenty of new magic to play with.

Enjoy!
–Jens Mönig