Programming with kids: madlibs

Sunday 31 July 2005This is nearly 18 years old. Be careful.

I’ve been looking for a programming project to work on with my 13-year-old son. He’s very interested in computer games, 3D graphics, Flash movies, and so on. He wanted to know more about programming (he’s done some ActionScript) and I wanted to share my love of writing software with him. But his natural inclination to advanced games was making it difficult to pick a project: he wanted to make 3D adventure games, or fast-moving arcade games. Those are do-able, but take a lot of time and planning. There’s a long ramp-up time where the output is not linear with the input: you’re writing many lines of code, and it doesn’t do anything.

At the other end of the spectrum are the kinds of boring toy programs that don’t excite kids: number addition quiz games, for example. They’re simple to write, but when you’re done, you’ve made the computer do something you don’t care to have done.

But even those quiz games are appealing to kids that really want to learn about programming. My son and I were talking this weekend about finding and dusting off one that he had written a year or so ago. Together we came up with a better idea: write a Madlibs program. This struck us both as really appealing: he liked it because it seemed like a fun program to have when the work was done, and I liked it because I could see it would involve a little bit of work, and would provide some interesting challenges. Also, it was easy to see a bunch of different directions it could be taken, each creating new teaching opportunities. And it didn’t require complex libraries or esoteric output modes: just console input and output.

So he and I set to work on it, and it lived up to its promise as a good program to work on. Read about the results in Programming Madlibs.


I love the categories for this posting: python, parenting.

You could write a book: Parenting with Python.
Thanks for posting this, Ned; I love this topic. I've been looking at the same thing with my daughter, and recently gave her "Python Programming for the Absolute Beginner" by Dawson, which I recommend. (I've enjoyed glancing through it, too, and I think the use of game-based examples makes it engaging for a novice programmer.)

The funny thing was when we were working on a small game one day, and we had to produce a random number. As I would usually do at work, I said we should google [python random] when she looked at me and said, in a surprised manner, "Dad, you don't know about randrange? I thought you've been programming in Python for 10 years!" And I don't think she was buying my line about business programming being very different from game programming. Guess I'm not writing enough random test cases!! ;-)
I have been looking for something similar to do with my son, who has not yet started programming at all. We did build a MadLibs program in HTML / JavaScript last year, though, so I appreciate the hard-core approach to this application.
Does it have to be python? If Java is ok, then you might have a look at robocode. It is a game where you have fighting robots. You can program the robots to have different tactics. It looks fun, but I've only just begun looking at it. Good luck, regardless!

Add a comment:

Ignore this:
Leave this empty:
Name is required. Either email or web are required. Email won't be displayed and I won't spam you. Your web site won't be indexed by search engines.
Don't put anything here:
Leave this empty:
Comment text is Markdown.