First Class Procedures for Scratch
Monday, May 10th, 2010
Scratch is a fantastic first programming language. And afterwards kids go on to study C and Java, right? Think again.
Is Scratch’s brilliance really all about programming? Can the Scratch experience be reduced to events, threads, conditionals, loops and variables? What about expressing ideas, imagining activities and reflecting results? What about researching, discussing and remixing? Participating? I love Scratch, because it makes such abstract concepts come to life. To me, Scratch’s biggest gift is that it lets kids create. And share. Produce. Plus, Scratch is intrinsically fun and gratifying. But it’s not easy. Let me repeat that slowly: Scratch. is. *not*. easy. Ever tried to impress someone with an interactive presentation? Ever had to invent your own user interface framework? These things are hard. Resources have to be organized, goals must be evaluated, steps need to be carefully layed out. The Latin word is programmare. Programming. Programming helps organizing hard stuff.
Or does it? How often did silly syntax get in your way, did enigmatic grammar force detours on you? I also love Scratch because it liberates programming from this sort of bigheadedness. Scratch lets kids focus on the hard stuff without imposing silly rituals. More programming languages should be like this.
Why not stay with Scratch?
Until now Scratch had a hard ceiling. You could do amazing projects with Scratch, but you would bump into that ceiling soon enough. It doesn’t have to be this way. Last summer two Berkeley CS instructors (Brian Harvey and Dan Garcia) asked me for a version of my experimental BYOB software which they could use in a new undergraduate pilot course named “The Beauty and Joy of Computing”. As that course unfolded, Brian Harvey (easily one of the world’s best programming teachers), involved me in a discussion about first class procedures. Together we began experimenting with enhancing BYOB little by little, and by late fall we suddenly realized that we were inventing a new graphical programming language. Only we weren’t. It’s still Scratch. We just added less than a dozen new blocks, re-wired some things under Scratch’s hood and tweaked the GUI a little. What’s more, we didn’t even invent these new blocks ourselves, we took them from the Scheme dialect of the LISP programming language.
But see for yourself what it lets Scratch do now:
byob.berkeley.edu
BYOB 2.99 is an alpha test version for the new BYOB 3, which is scheduled for release this August.
Highlights:
- new Reference Manual with lots of examples and tutorials by Brian
- Tools library of higher-order-functions (also by Brian)
- lambda, including full closures (anonymous custom blocks)
- anonymous dynamic lists
- lists of lists
- global and local procedures
- SICP style OOP
- state-persistent projects, Smalltalk-style image based programming
plus all the goodies of previous versions:
- custom blocks “build your own blocks” (from v.1)
- sprite aggregation “nested sprites” (from v.2)
- inspect the underlying primitive code in the Elements visualisation
- share projects as windows .exe
- open or import any Scratch project/sprite
Enjoy!
-Jens Mönig