Skip to main content

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...

Comments

Popular posts from this blog

Easter at Blackhead

Camping out on the headland, miles from anywhere. Big swell, off-shore winds, clear crisp nights and smoke from the wood fire. Sometimes it's so rewarding to get out from under the pressure of your life and just be a family of humans.

How to rename an XML Node in C#

This was driving me crazy - here's an easy cut and paste solution to not being able to use the DOM to rename a node for lazy developers like me: public static XmlNode RenameNode (XmlNode node, string namespaceURI,string qualifiedName) { if (node.NodeType == XmlNodeType.Element) { XmlElement oldElement = (XmlElement) node; XmlElement newElement = node.OwnerDocument.CreateElement(qualifiedName, namespaceURI); while (oldElement.HasAttributes) { newElement.SetAttributeNode(oldElement.RemoveAttributeNode(oldElement.Attributes[0])); } while (oldElement.HasChildNodes) { newElement.AppendChild(oldElement.FirstChild); } if (oldElement.ParentNode != null) { oldElement.ParentNode.ReplaceChild(newElement, oldElement); } return newElement; } else { return null; } ...

Democracy in Action...

I have to vote in the US Senate Election Tomorrow. Okay, I don't have to vote, but being an Australian American, voting is something we do. Australia has compulsory voting, which I am overwhelmingly supportive of. People often assume that the point of compulsory voting is to somehow educate people about politics - to force them to have an opinion. The reality has nothing to do with voters, and everything to do with ensuring good governance - By forcing politicians to care about every voter, rather than just the ones who can be bothered to go down to the poll both and vote, it means that politicians are consequently forced to address the needs of all the citizens in the country. Under a non compulsory voting system, it's mainly the wealthy and educated who vote. I was a little shocked to find out that part of the aim of the campaign advertisements that have been confusing me for the last month on TV is not to encourage voters to vote for one candidate or another, but to discou...