Scratch: Teaching kids to think in blocks

The Scratch Cat
The Scratch Cat

Over the weekend I spent a few very rewarding hours with my ten-year-old son playing with Scratch, MIT’s drag-and-drop educational programming system. I’ve often wanted to “get him into” programming (I was a little younger than he is now when I started, and at ten I was beginning to get really interested in writing code on the old 8-bit machines) but haven’t really known where to begin. It turns out the ideal place was Scratch!

Although I’ve been aware of Scratch for a while (it comes pre-installed on the Raspberry Pi I got a few months ago, which I’ve not really done anything with yet) I only really looked at it properly last week, when a friend of mine asked me for a little help with an introduction to CS course he was doing, in which the first problem set was to create something in Scratch (I helped him make a Space Invaders clone). It was while working on that I realised I really should introduce Jake (that’s my son) to Scratch. After I mentioned it to him, it turned out he’d looked at it a little at school, and so it was decided – we’d spend a bit of time on Sunday playing around with it.

What is Scratch?

In case you’ve not heard of Scratch, it’s basically a block-based drag-and-drop programming system written by the Lifelong Kindergarten Group at MIT and supported by several research groups and industry players (including Intel and Google). It’s aim is to help educate kids in the science and art of programming in a way that’s fun and easy to understand. To quote the “about” page on, Scratch is:

[…] a programming language that makes it easy to create your own interactive stories, animations, games, music, and art — and share your creations on the web.

Scratch is written in Smalltalk (it runs on Squeak) and has built-in support for graphics (centered around sprites which are placed on a stage and interact with one-another), sounds and basic input/output, all of which makes it an ideal way to engage today’s game-saturated youngsters with the fundamental concepts their console games build on. Sure, they’re never gonna make the next Call of Duty with this thing, but there’s a lot of fun to be had creating simple games and animations, and all the while actually learning from the process.

Scratch Society

Another great thing about Scratch is that it’s linked in to an online social network – when you create something, you can share it on the web right away, directly from the UI. This was another big plus from Jake’s point of view – he wanted his friends to see what he’d made, and Scratch makes it very easy to do that. You simply sign up for a (free) account on the scratch website (in his case, I had to provide my email as parental consent, which I also like very much) and then click “Share” in the Scratch UI to upload your project, which then plays directly on the site in a Flash-based player, and can also be downloaded by other users (‘Scratchers’) to be played or modified locally.

This sense of community plays very well to kids in today’s connected world, and is a world apart from my own early programming experiences, where I could either print out listings (on tractor feed paper – good God I feel old!) or, later, put my files on disk and take them to the local PD library. Eventually of course, I uploaded them to the local BBS, but that’s another story…

Getting started

Main screen of Scratch at startup
Scratch at startup

When started, Scratch shows the main parts of the UI (see left). The Scratch Mascot, Scratch Cat appears on the stage on the right. The area in the center is where you edit scripts, costumes and sounds, and the far left has the blocks that you combine to build scripts.

Blocks are split into a several categories depending on their function, and everything is colour-coded to make it easy to find what you’re looking for.

As I mentioned above, Jake had already had a (very short, as it turned out) introduction to the software at school, and so was right at home. He’d done a little work with changing the position and rotation of the default sprite, so we decided to build on that, and make a simple but fun game in which one would have to drop an object onto The Scratch Cat (or, as we decided, his evil twin!) in order to destroy him (and prevent any further evilness). This provided a challenge that we could easily meet within our allocated hour-or-two, and gave me the opportunity to teach Jake to think incrementally about the problem – to break it down into steps, rather than follow his first instinct to try to tackle the whole problem at once. It also meant we had the minimum number of new sprites to create, and that Jake could take care of them himself – an important consideration when you have (as I do) all the graphical prowess of a housebrick.

Building Blocks

So, we happily hacked away for a while, first getting the Scratch Cat to run to and fro across the screen to give a moving target, then putting in a bomb sprite and making it respond to left and right keypresses, before adding in the logic to actually drop the bomb. This then took us down another incremental route – how to actually ‘destroy’ the cat sprite? How to make sure it disappears at the right time? How to add an explosion graphic and switch to it appropriately? I introduced Jake to the concept of looping, broadcast messages, key listeners and event-driven programming, all without him having to think about the (booorrring) concepts behind them. He loved it, and so did I. Me and my son were coding together, and it was fun!

Bomb The Cat! in Scratch
Bomb The Cat!

We fixed bugs, we changed things, we even fired up Audacity (which he’s also used a little at school!) and put together some sound effects. We added in a limited-bombs feature to make a game of it, and generally had a really great time tinkering with what we’d made. Granted it’s not Grand Theft Auto VI (or even Little Big Planet 3), but it’s a fun little game, and more importantly, it’s ours.

The screenshot on the right shows the finished game running in Scratch. The bomb sprite’s scripts appear in the main script area, and the stage on the right shows the game running. We found the evil cat on the boardwalk, and are just about to try to get him with our first bomb. As well as the scripts visible here, there’s also a “forever” loop on the cat, that keeps him running and checks if he’s been hit. The stage itself has a couple of scripts, triggered by broadcast messages, that switch to a “winner” or “loser” screen at the proper time.

We’ve finished Bomb the Cat (for now, at least) so why not check it out and maybe waste five minutes having a little fun? You can find it on Jake’s page on the Scratch site: (note that you may need to click in the Flash window before it will accept any keypresses – this seems to be a limitation of the player).

The next steps

Jake’s assignment this week is to come up with a new game idea for us to make next Sunday, and I think by then he’ll have a few different plans – Scratch seems to have grabbed his imagination in a way that other programming ideas we’ve tried in the past never have. He has it installed on his laptop too, and has played with it in my absence this week, which also pleasantly surprised me.

He’s also asked me to teach him Blender, which makes me wonder what exactly he’s planning for the future. Perhaps today “Bomb the Cat”, tomorrow “Gran Turismo 9”?

In any event, Scratch turns out to be a great way to get kids into programming, as well as being a lot of fun. If you have children of a similar age (or even a bit younger) I’d urge you to introduce them to it. Now. Who knows – you might just be nurturing the next David Braben or Peter Molyneux. And regardless of that, you’re sure to have a lot of fun too!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s