Thursday, August 04, 2005

Teaching Kids to Program

I spent an hour today teaching the Aranda Primary second graders how to program. Rather than get involved with setting up compilers, and configuring software, we wrote code using a simple logo-style language, and a pencil. Then we 'ran' our 'programs' in our heads. It sounds a bit obscure, but it was actually really fun!

The way it worked was this. One kid gets to be the 'programmer', while the other gets to be the 'robot'. The programmer can issue the following commands to the robot:
  • Go Forward
  • Go Backward
    (These Go commands have an optional parameter, which is the number of steps)
  • Stop
  • Turn Left
  • Turn Right
  • Turn Around
  • Pick Up
  • Drop
The robot only listens to his/her programmer, and follows the commands exactly (even if they're stupid)

The aim was to write a program that picked up a teddy bear, and put it into a basket. After each having a go being the robot, and being the programmer, and test driving our robots, everyone wrote down their program on a piece of paper. Then I mixed up the programs, and I read the commands to the robots (making sure nobody got to be a robot for their own program)

When run-time came, only one program executed successfully. Some robots ended up walking into desks or walls, and one ended up in the hallway. This gave me the opportunity to teach about bugs, and debugging. We all 'debugged' our programs using an eraser (the number one bug was mixing up left and right) and ran them again, with much greater success.

Afterwards, I sat with the kids and discussed the fact that while computers could do amazing things, and appear to be really clever, they only ever did just what they were told, and so they were actually pretty dumb. And that software programmers have to deal with the same sort of problems that they'd faced today, every day.

It was funny watching the 'programmers' blame the 'robots', for their bad code. You certainly wouldn't see anything like that at a professional place like TOWER Software...

No comments:

Post a Comment