Tuesday, September 11, 2007

You Program My Back, I'll Program Yours

If you are a math/science/computer nerd and you have a child, you have undoubtedly wondered how you can teach your child programming. I googled for such a thing more than once and found the usual suspects: BASIC, LOGO, etc, etc. The free ones were all half-finished or too hard, the good ones were all expensive or geared towards classrooms.

I tried teaching Number One Son (8 years old) some pseudo-codey stuff to do simple math problems and learn about loops. He enjoyed that, but we didn't get very far and I always had to be the virtual machine to check if his program ran.

However, MIT has recently come up with something that absolutely rules--Scratch. And it's free!

Scratch is graphical. You drag the little components around to assemble a program. For instance, to make a loop, you drag your components into a loop widget, which wraps around it like a vice. If you want to construct a conditional, you get out the "if" widget and drag and drop logical/mathematical conditions in from the toolbox. Just fill in the blanks and go.

The GUI isn't just for show, either. You don't feel like you are using the mouse to write a program, you feel like you are literally assembling a physical object. And it eliminates syntax errors, which is a major deal in the under-13 crowd. Furthermore, the graphical programming language ties right in to the very graphics-oriented programs Scratch is targeted towards and children love. Creating and animating sprites takes just a few clicks. Object collision is just a matter of checking if two colors are touching. And this is all clearly presented enough that an 8 year old can (and has) figured most of it out himself.

I think he learned more about programming in 2 days with Scratch than he did in all the previous years of my bumbling explanations. He goes off and works on a program for a while and then will come to me with a question about how to do something. And they are pretty sophisticated problems (considering his age), such as how to cycle through sprite costumes and wraparound at the end or how to keep various sprites in sync. With the concrete example of his non-working program providing the motivation, the explanations of modular arithmetic or semaphores stick much better.

So far he's created programs that simulate a robot in a maze, animate a rocket flying to the moon, teach the alphabet to his two-year-old sibling and even one generic drawing program with adjustable pen size and color. All 100% on his own.

Windows and Mac only, but:

  1. They claim they'll have a Linux version out "before the end of 2007".
  2. The usefulness, fun and polish of Scratch is more than worth setting up an old PC with Windows.
It's possible to upload your program to share with other kids, but we haven't tried that yet. Videos of Scratch in action..


  1. Forget the 8-year old, *I* need this.

    Very cool.

  2. I tried messing around with it myself, but I was a little frustrated. I think that's because while it's a great tool for teaching *programming*, it's a terrible tool for teaching *software engineering*. For instance, there's no way (that I know of) to create functions and arrays are totally missing as are strings.

    It's like giving a kid a work bench and toolbox. They can do some really awesome stuff, but you can't build the Golden Gate Bridge that way.

    Of course, if you are an adult who isn't (yet!) a programmer and would like to learn, I definitely recommend it.

  3. Saying I am not yet a programmer is like saying my daughter is not yet 7 feet tall.

    Massive understatement, and also: not bloody likely

  4. You used "normalize" correctly today, you can do it. Get confident, stupid!

  5. My oldest is 14yo, and we've been through a lot of free programming languages/environments (and a few that are not free). My son wants to write games, so his take on the various languages reflects their ease of use for that purpose.

    He started with Stagecast Creator for which a free trial is available, but eventually you would have to buy it.

    KPL is free, though the newest version, Phrogram, is not. This one requires one to write the programmer in text, so it feels like a real programming language.

    Alice is a nice visual programming environment, but as an object-oriented language lacking casting an polymorphism, it was easy for my son to come up with things he wanted to do, but couldn't. It is nice for making cute animations, but not so great for games.

    Game Maker is commonly used by tech camps, and has a lot of game-making features built it. It is my son's environment of choice at the moment.

    Also, not cheap, but Lego Mindstorms (or their newer NXT system are a fun way to build and program simple and not-so-simple robots!

  6. I'm finally getting around to evaluating KPL, Alice and GameMaker.

    Typing isn't really an option for an 8 year old. I tried out GameMaker last night, but it requires a later version of Windows than I have. :(

    Alice looks pretty awesome, though. Your teen may have found stuff it can't do, but it seems a few notches more powerful than Scratch, since it supports things like parameters, lists, etc. I think Number One is going to love it.