Coding for Kids

Recently I was invited to my son’s primary school to deliver a lesson on coding. I currently teach this to year 9s and I’m moving toward becoming a computer science teacher full time so I graciously accepted the invitation.

First off, I feel the need to clear something up. Coding, and programming are not the same thing. They are separate skills and even have separate, all be in similar, applications.

Coding is language, computer language more specifically. I try to think of it in the same way as a spoken language. I speak english, I like to think that I speak english well and I’m able to use the english language to express myself coherently to all sorts of different people and scenarios. I’ve attempted to learn other languages, Spanish, Japanese and French and found that I have no skill for foriegn languages. In each case I’ve learned some of the vocabulary and grammar but I’ve never got beyond the point of very basic communication.

Coding is the same. I favour two or three languages and dabble in others. While my coding skill is much better than my skill for foreign languages I suffer in the same way as I do with Spanish when I use computer languages with which I’m less familiar where in I am able to perform the basic ‘generic’ functions but not able to utilise the strengths of the language.

Programming is giving instruction. Giving a computer, or anything else a set of instructions that are to be carried out in a specific order. It sounds simple but and it is until those instruction have to include things like selection, looping processes or exception handling.

In terms of computing, coding and programming do go hand in hand. You use code to write a program that the computer can run. Coding doesn’t really exist without programming, which I think is the main reason for the ambiguity. But programming does exist without coding, television, plays, events all have programs and one must be able to compile and understand those programs.

There’s been a big push for getting computer science into schools and exposing students to computer programming at an early age. While I’m all for the push I get the sense that there is quite a bit of confusion about coding and programming in general.

The reason that I feel I need to clarify the difference is that tools such as Scratch, AppInventor and the like are being pitched as a way to teach young students to code and it’s almost a disservice. These applications have been developed in order to bridge the gap between programming and coding and I think they do that as well as can be done. However the visual nature of these tools mean that they are better suited for teaching programming over coding initially.

The Lesson

First I talked a little about computers, what they are and why they are useful. What a program or app is?

The Counter

I found the fastest counter in the class and had them try to count to ten faster than my iPad could. After they lost I had them try to count faster to ten than the iPad can count to 1000. They stand a reasonable chance of winning this one, but only because it’s an old iPad. I then had them race an optimised version of the counting program and showed them just how quickly the computer can really count to 1000, 1000000 and 1000000000.

We then discussed the reasons that the fastest counter couldn’t keep up.

  • Couldn’t speak quickly enough. – a valid point, computers don’t need to speak each of the numbers, but it does need to draw them. Could they write 1 – 10 faster than a computer?
  • The computer probably skipped some numbers. They dared accuse me of cheating.

Afterwards we talked about coding and how computers can follow instructions super quickly as well. Coding is simply a way that we give the computer instructions that it can understand. It will then follow them super-fast and get them right every single time.

Head Shoulders Knees and Toes

This attempted to demonstrate why speedy and flawless instruction following is useful but more shows that humans are generally terrible at it, which is why we invented computers.

The kids stand up and place their hands on the part of their bodies that you call out. If they get it wrong they have to sit down.

  1. Call out everything in order for a bit, then I threw in a few random calls. This eliminates most the class right away.
  2. Call out everything in order but get gradually faster and faster until everyone is out. Doesn’t usually take very long.
  3. Conclude with the class that they are all lousy computers.

We then discussed some of the problems that they had.

  • Couldn’t hear the instructions. – Computers will always hear whatever instructions you pass it.
  • Expected one instruction but was told another. – Computers don’t try to anticipate what the next instruction will be.
  • “I can’t move that fast” – While it is possible to move two quickly for a computer, they are much much faster than humans.


We then moved on to Scratch. I talked briefly about it and then showed them a quick introduction video from the scratch website,

I then demonstrated two example games that I had created in Scratch (link below) and took them through how to make them.

Things to note:

Running Scripts – Scripts will action if they are clicked even if they are not in the scene, or attached to anything. So if you get a child that has accidentally rotated their sprite upside down, just go into motion and click on one of the Rotate script until the sprite is correctly oriented.

Events – Every new action starts with an event. ‘When Greenflag is Clicked’ is a good on to start off with. Basically any set of scripts will need to have some type of event at the top.

Motion – Many of the motion scripts will automatically update according to where the sprite is in the stage. So for example if you wanted to have the sprite start at one location and then glide to another; Drag the sprite to the position at which you want them to start and then move a Go To script onto that sprite. Then reposition the sprite to where you want it to move and drag in a Glide To script. The X and Y of both those scripts will have automatically worked themselves out so that you don’t have to.

I’ve attached the documents that I used below, feel free to use them.



Author: D

I'm a student developer living in the UK. I'm on a 1 year placement and am due to finish the final semester of a Computer Games Programming degree in 2015.