a glob of nerdishness

May 19, 2007

Scratch

written by natevw @ 1:38 pm

Scratch, designed at MIT, has been making a splash in major news outlets lately. The Scratch project is basically Xcode meets YouTube for games. Sounds strange, but it’s a combination of a desktop-based integrated development environment and a community-based game sharing site. In order to pull this off, the designers developed a programming language that succeeds at being both simple and powerful.

When I saw the headline in the middle on BBC News, I was instantly suspicious:

Scratch front page BBC News

The picture was an instant reminder of Lego Programming hype. (Interesting aside: if you google lego block programming, the BBC article takes second place to that very post!) The article itself is less sensational, toning the headline down to “Free tool offers ‘easy’ coding” and revealing that it is actually a desktop application that allows creation of games.

Trying it out

Feeling that this had all been attempted before, I didn’t think much more of it until I got a note from Hannah, who had also seen the article: “Would this help me understand you?” I guess it’s worth a shot! She downloaded it, and together we figured out how to get the thing started. The cryptic “Open” dialog box was a bit rough, but after we figured out we needed to select the Scratch.image file, she was on her way.

As I watched her learn the “language”, I became impressed with its enlightened design. Scripts are indeed built from graphical pieces, but the process is much more powerful than a mindless succession of commands and much less tacky than drawing flowchart lines. The user can nest commands into control structures and insert test questions into conditionals. Like an open-ended puzzle, the shapes and colors of these “building blocks” give subtle clues as to what pieces may be missing.

Impressive simplifications

Programming in Scratch is a completely interactive affair. The user can attach a number of independent scripts to graphical sprites. Each script is started by one of many available triggers. These triggers are always active, despite the presence of a green flag (just another trigger option) and a stop sign (just an emergency kill switch) in the interface. The interactivity goes deep — there isn’t even an “initial stage”. What the user drags around with the mouse and what gets moved via a script are on equal footing. This is a daring move, forcing the explicit scene initialization in some cases, but greatly simplifying the user model. This is just one of many well-executed simplifications. Variables are also made accessible to beginners, being visible by default and having at most two scope options.

As mentioned before, scripts are attached directly to sprites, meaning that in lieu of a master “puppeteer” script, the sprites are essentially autonomous. All scripts run concurrently upon being triggered. This is the coolest simplification, and also means parallelization becomes an integral part of this beginner’s programming language! Concurrency is heavy wizardry when tacked into many programming models, but is very intuitive in the context of sprite objects. The cat has ideas and the mouse has its own. While shared variables can be used to communicate between scripts (and are an easy concept for beginners), there is also a global message broadcast system. Scripts can broadcast messages, asynchronously or synchronously, which are received by all scripts that are triggered by that particular message.

Wide audience

Scratch doesn’t just encourage algorithmic thinking with the usual control structure and variable concepts. It also teaches important parallelizing patterns that “real” programmers typically encounter only in still-esoteric languages. Scratch can help my wife understand my field, and I hope it can be effective for younger learners. (With hardly any clues from me, Hannah made a reasonably involved Island Rescue game after only two other experiments.) The publicity is justified. What came as further surprise is that it can inspire my programming patterns and design strategies too! Well done, MIT!

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.