It’s been a while since I wrote my first article on how to teach programming to kids. Since then, I’ve been able to try a lot of new stuff, some of which has worked, some of which hasn’t. I will share my experiences with you so that you can make an informed choice with your own children, whether you’re a teacher or a parent.
During the first term, my students were introduced to programming through small steps: first, they programmed each other on paper, playing a robot; then they played light-bot, an online game which perfectly illustrates how programming works. Then I moved them to robomind, an evolution of the old logo turtle which, in its latest version, can even be used to program lego mindstorms. Finally, we used MIT Scratch for game programming, which proved a resounding success: most students managed to complete a game in three or four lessons.
My challenge, then, was to introduce them to real programming: not a watered-down version for kids, but the real thing. In order to do this, I first had to give them a reason to learn. The way I did this was by teaching them cryptography.
Cryptography is of course very complicated, but some basic concepts can be taught to grade 5 and 6 children. Ciphers such as the Caesar cipher, which consists of moving each letter a certain amount through the alphabet, are easily grasped. The way I taught this was by suggesting increasingly difficult puzzles: I’d start the class by displaying a message on the board and, without further help, I’d ask them to decipher it. To my surprise, they did it without help a couple of times. When they didn’t get it right, I would give them clues one by one: for example, I’d give them a list of the most frequent letters in the English language; the most frequent digraphs, and so on. Students were in groups and it became a competition, without much encouragement from me. The competition provided the motivation and the codes were almost always eventually cracked.
I also used the NSA webpage for kids, which has a lot of puzzles and even allows you to learn Morse code. The children were really excited about it. At the end of each lesson, I’d let the children write their own secret messages using the different techniques we learned during the class; then I’d put teams against each other, trying to crack the rival’s message.
I introduced the topic of programming by telling that computers made it really easy to cipher and decipher any message with very little work. That instantly caught their interest and they were soon asking me when we would start. After a while, I began to teach them Python.
Using the Python IDLE editor it was easy to get them understand basic concepts such as variables or conditionals. First we saw them in the console, where the result of each command is displayed instantly; then we started writing a full-fledged program in the editor. Arrays took a bit longer and for loops were a bit too much for some, though most got it without problems. The way I taught this concepts was by making a really simple quiz game, which is made with a raw_input and acouple of if…then statements. I introduced for loops to simplify the code, putting all questions inside an array and then looping through them.
After this, they were ready to start cracking codes: all you need is an array with the letters of the alphabet and an algorithm that loops through a message and replaces each letter by a different one. Then you can make a function that deciphers by taking the same initial function and giving it the opposite input. Finally, you can make a function that returns every possible message from a set of letters, so that students can just look and find the right one. There are of course lots of variants.
Looking back on this, I think using Python was a mistake. Python is quite powerful and it does qualify as a full-
fledged programming language, but creating things like good-looking graphics was quite beyond the ability of my students, since it requires the sometimes not-so-intuitive Tkinter library. One of the parents recently told me about Small Basic and I am under the impression it is a much better choice for children: it allows you to build amazing applications with very little code and displaying complex graphics on the screen is extremely easy. Small Basic also comes with a tutorial on how to teach it, which goes from making a simple game to playing with fractal shapes.
Summarizing, if you are a parent or educator, I recommend you to take a look at Small Basic, which seems to be the perfect programming language for children to get started. You can use the same approach of using cryptography as bait (and also because it’s interesting for its own stake) or you can start directly with the Small Basic program, which also seems engaging and fun.
Either way, the fact is right now there are so many great tools for teaching programming to children that it’s hard to choose from them. Using any of those is sure to produce great results and lead your students towards a future where they will be fascinated with computers instead of afraid of them.