Programming for Kids

I really believe in people being able to code. The extended internet is an empowering place for individuals in the 21st century, but if you can’t code, you’re mostly relegated to being a consumer.

I really believe in kids learning to code. My kids get some ok teaching in IT at school, but it seems to revolve around Microsoft Office in primary school (they’ll be ready to kick arse should we time travel back to 1996). More useful stuff at high school, but where’s the code?

My son Lochlainn really loves computer games, including flash games, and wants to make them. He’s just getting to an age (about to turn 10) where he can handle concepts of coding. Last year we really went hard with MIT’s Scratch, a *very* cool environment for kids to learn to code, but it has serious limitations, so any kid who really likes this stuff will hit the walls fairly quickly. Still, it’s an excellent starting point, I can’t recommend it highly enough.

But now it’s time to move to bigger and better things. He wants to make real games. He’d really like to make World of Warcraft, so a lot of my job is to lower expectations a bit (or else raise a billion dollars in seed capital, but that’s not been going so well). So I’ve been trying to work out, what’s the right stuff to teach him? What’s are the best first steps from being a 9 year old n00b, to being an at least partially self-educating code grommet?

Coders my age often bemoan the lack of code like we had it in the 80s. All the computers had basic interpreters, and that was a good simple environment to learn; you couldn’t do much, so you couldn’t get too confused. And so, the temptation is often to look for tools that are like what we had on, say, the Commodore 64.

I wonder if there’s a better way to turn kids off coding than this approach? You take a kid who plays WoW, console games, online flash games, and give him/her something that lets you go “10 print “Hello World”; 20 goto 10″, and they are going to think “well that sucks”. And fair enough too. We had low expectations because computers were totally crap when we were kids, really horrible. That’s not the case now. Kids now want animations, sound, multimedia, and there are environments entirely capable of giving that to them. Let’s start there.

Going down this path, the obvious first choice of tool for me was Adobe’s Flash. Professional coders will be going for the pitchforks and torches about now; “why are you recommending the vb6 of our time to our impressionable children”? It’s the right thing though. The games they play are often made in flash, this is the real stuff for them, so you get that feeling of being trusted with adult tools. Also, Flash has tools for creating animations which are simple and usable and powerful; a child can operate them, and you can do really cool stuff without touching code. Finally, ActionScript 3 (the programming language behind flash) is actually pretty good, it’s (almost) a real object oriented language, a dialect of javascript (well, ECMAScript). This is actually a bit of a problem, because it’s a pretty complex beast (it’s no BASIC), and the IDE is pretty poor, so actionscript coding inside the flash development environment is not entirely straightforward. But it’s doable, and once you learn a few tricks, becomes a bit more straightforward; getting there is my job.

Lochy’s started using flash to make some animations, and really took to it easily. We talked about making a game, and decided on a car racing game, top down view. I teach the approach of starting really simple, and improving in increments. The rough approach is going to be

  1. Create an animated car (wheels wobble? smoke clouds come out the exhaust? etc)
  2. Create a static animation of the car driving around (still no code)
  3. Add code so you can drive the car around a white screen with the arrow keys in a car-like way
  4. Create a track that fits entirely on the screen, make it so you can drive around on that
  5. Add some intelligence – maybe that you need to complete three laps, some method of measuring that you’ve gone the right way around the track, crash if you go off the side, stuff like that
  6. Add a second player who can use keys as well (W-A-S-D), now both can race around the track
  7. Add rules so this is actually a proper game (measure laps for both, have an end-of-game screen announcing the winner, some score counters on screen, etc)
  8. Now add computer controlled cars (maybe following an invisible line around the track? We’ll figure this out when we get there).

He’s already done 1 & 2.

I’ll keep writing about how this goes.

He doesn’t just want to make games though, he wants them in a slick website with sophisticated features; they should remember high scores and achievements, with the possibilities of social media integration. Kids now think in terms of the online environment. And of course he wants to have multiplayer functionality.

I’ve been using Google AppEngine for web applications. It’s free and quite spectacularly powerful, and relatively simple to work with. I code in python for AppEngine, and I think that’s a great language for kids to learn. It would be best to have a high level framework to add to this, and Django looks like the thing. I haven’t really used Django, but I want to try it, it looks strong and simple, and AppEngine has it available by default, so there are no tricks to getting it going.

The point here is that I think I’ll add this in a little while to what I’m teaching Lochy. AppEngine + Python + Django should prove to be a powerful web environment. You can write data driven web service like functionality in it, which you can talk to from Flash, so the Flash games can integrate with the backend. Sounds complex, but I think it’s actually pretty straightforward.

Flash + AppEngine + Python + Django. FAPD. A technology stack suitable for kids, I hope. I’ll write more on this.

Programming for Kids