Friday, July 07, 2006

Teaching a kid to program

David (age 8) is interested in robots. That interest scored him a Lego Mindstorms robot kit for Christmas one year. Once he built a robot, he had to "program" it. That made him aware of programming. Then he wanted to learn more about programming.

If you have a kid who would like to learn to program, one simple place to start is this page:

Botz puzzles

You have to register, but otherwise the site is free. You can learn some simple programming concepts here.

But if you want to teach/learn about "real" programming, you end up with an interesting question -- which language to use? Should it be C? C++? Java? Python? It is a hard choice because there are cost issues, learning curve issues, palatability issues, etc. After doing some research, this is the language that David and I have been using:

Kids programming language

Here are some of its advantages: it is free, it is easy to download, it comes with a ton of example code, and you can do "real" stuff with a (relatively) small amount of code. Also, many of the examples are games, which David really enjoys, and letting him load/compile/run games was an easy way to get him interested in the KPL package. And it works. We have had no problems with it.

The first thing we did was to take sample programs and try modifying them in very simple ways. For example, we took the "maze" program and we changed the width and color of the lines in the maze. Really simple stuff like that.

Next we tried a very simple program - draw a single line on the screen. It takes 3 or 4 lines of code to do that, and you can easily figure out what the lines of code need to be by looking at examples.

Next he drew a triangle. That taught him about coordinates. Then he drew 5 triangles side by side using a loop. That taught him about loops. Then we used a method to draw the triangle, to learn about methods.

Next we drew a simple 3x3 grid. Then we colored the squares on the grid (like a checkerboard). Now we are using loops to do it so we can draw an actual checkerboard.

Overall, it has been a lot of fun doing this. I would say that age 7 or 8 is a good starting age. Your kid needs to be able to read and write, and knowing how to multiply seems to be almost essential. If you want to go younger than that, you probably could because the language has some Logo-like turtle commands like MoveTo and Pen. But we used the Botz puzzles mentioned above to move through that stage.

There are two things that I have found interesting in watching David. First, he seems to have a real interest in it. There is something he enjoys about "telling the computer what to do." Even changing simple things like line color and width is impressive to him. We wrote a text program to create multiplication tables and that was exciting to him. Second, once he learns a concept, he seems to be able to extend it. So, if you teach him how to draw a line, he can then "see" what he needs to do to draw a triangle or a grid without much prompting. Each new thing we learn to do requires a little research on my part -- he is not at the point where he can look through a 300-line example program to learn how to do something (for example, how to load/paint/move sprites). But I can help him with that, and then he can apply the concept himself. It has been a lot of fun so far.

If you know of other resources for teaching children to program, I would love to hear about them. Thanks.

Comments:
Have yyou looked at QBASIC? Here is a Tutorial. Type QBASIC into Google to find the compiler.
 
Marshall,

If you have a Macintosh, one of the most intriguing things to take a look at is something called the "Quartz Composer". It is a visual (no programming language whatsoever) way of programming the Apple graphics system and you can do some mind-blowingly cool visuals without programming.

It's free and it's good for children who don't have the math and language skills in place yet.

It may be a cool thing fo
Screenshot here:
http://www.devworld.apple.com/documentation/GraphicsImaging/Conceptual/QuartzComposer/art/untitled_editor.gif
More info here:
http://www.devworld.apple.com/documentation/GraphicsImaging/Conceptual/QuartzComposer/qc_intro/chapter_1_section_1.html

-B
 
For some reason the URLS in my comment didn't stick. Just Google for "Quartz Composer" and look for a screenshot.
-B
 
Hi Marshall - one of the KPL guys here. Thanks for finding it, trying it and blogging about it!

Small world thing: we met in NC way back in 95 when I lived in Chapel Hill, and we were both doing some consulting work for a big San Francisco company. I've been very happy to see your success since then. How Things Work ought to be in a book of .COM successes - anyone written that book yet? :D Fun play on that: my interest in software has always been making things that work - very glad that you and your son have found that KPL does!

Wanted to add a few points that might interest you. KPL v 2, which will be out this summer and is in final beta now, does in fact have LOGO-style sprite commands, specifically to help even younger kids. Also, we have an unreleased "alpha" wrapper that allows LEGO Mindstorms programming from KPL v 2 - that's been back burnered, but if you're interested enough to play with it we could send it along. Last, I thought I'd point you to a paper on Computational Thinking in case you hadn't seen it yet. Jeannette Wing, chair of the CS department at CMU, coined the phrase. We certainly agree with it, were working on the problem before we discovered the paper, and it's a basis of KPL's opportunity. I suspect it'll make a lot of sense to you, too, and that it fits with your observations of how interesting your son found it to "tell the computer what to do." It's linked near the top of her home page: http://www.cs.cmu.edu/~wing/.

If you'd like to email me, I'm at jon@kidsprogramminglanguage.com.

Thanks again!
 
In KPL, look at the pinball example. It is a complete pinball game in 1,400 lines. It is a very efficient language.
 
Post a Comment

<< Home
ARCHIVES © Copyright 2003-2005 by Marshall Brain

RSS

This page is powered by Blogger. Isn't yours?