KeyStage

Key Stage 1 computing · Algorithms and programming

KS1 programs: how algorithms become code on a device

A program is an algorithm written in a form that a digital device can follow. In Key Stage 1, children learn that tablets, computers and programmable toys all run programs made by people, that each device understands only a small set of commands, and that it carries out those commands one at a time, exactly as written. The key step is turning a plan in words into commands.

From algorithms to programs, explained

This topic builds on the idea of an algorithm: a precise plan in the right order. A program is that plan written down in the particular language a device understands. If an algorithm is a recipe written for a person, a program is the same recipe rewritten using only the buttons or blocks a particular machine can read. The device cannot read the recipe in ordinary English, so someone has to translate it.

Children meet this with devices that are easy to see working. A floor robot has buttons for forward, backward, turn left and turn right. On a tablet or computer, children might snap together on-screen blocks, each one a command such as “move” or “say”. Schools choose which tools to use, and some children first lay arrow cards on the floor. The idea is the same whatever the equipment: each command is one small instruction the device already knows.

Children also learn that a device does not think about what you meant. It carries out the commands in order, one at a time, even when the result is obviously wrong. A robot told to move forward four times will move forward four times into the wall. This is why the algorithm has to be precise, and why the translation from words to commands is worth doing carefully.

It helps children to know that programs are everywhere and that people write them. A programmable toy, a tablet, a games console and a washing machine all follow stored programs. In Key Stage 1, children are not expected to type code. They build short programs, run them, watch what happens and fix anything that goes wrong, which is the statutory expectation to create and debug simple programs. Debugging has its own page.

Teachers often check understanding by asking children to show the same algorithm in several forms: spoken, drawn as arrows, and built as commands or blocks. When your child can explain that the first is the plan and the last is what the machine reads, they have understood the main point.

Words your child will hear

Program
A set of commands, written so a device can follow them to do a job.
Command
One instruction a device understands, such as forward, turn right or play a sound.
Code
The commands or blocks that make up a program.
Digital device
A machine that follows programs, such as a computer, tablet, programmable toy or games console.
Run
To make the device carry out the program. Teachers also say “execute”.
Block
A piece on the screen that stands for one command and snaps onto the next.
Algorithm
The plan in words or pictures, before it is turned into a program.

What the National Curriculum says

In Key Stage 1, pupils should be taught to:

  • Understand what algorithms are, how they are implemented as programs on digital devices, and that programs execute by following precise and unambiguous instructions
  • Create and debug simple programs

Objectives from the National Curriculum in England, © Crown copyright, used under the Open Government Licence v3.0.

Try it: turning an algorithm into a program

A floor robot stands on the start square of a grid, facing up the mat. The treasure is three squares straight ahead, then two squares to the right. The robot has the commands Forward (one square), Back, Left (a quarter turn on the spot), Right (a quarter turn on the spot) and Go. Write the program.

  1. Write the algorithm in plain words first: go three squares up the mat, turn to face the right, then go two squares.
  2. Check what the robot understands. It has no command for “three squares”, so the algorithm needs to be rewritten using only the commands available. Forward moves one square, so three squares means pressing Forward three times.
  3. Turn the next step into a command. Right makes the robot turn a quarter turn on the spot, so it now faces right. It does not move to the next square.
    Forward
    Forward
    Forward
    Right
  4. Finish the journey. The robot is now facing right and the treasure is two squares ahead, so press Forward twice more.
    Forward
    Forward
    Forward
    Right
    Forward
    Forward
  5. Press Go to run the program. Watch the robot and compare what happens with the plan. Your child can point at each square as the robot reaches it.

Forward, Forward, Forward, Right, Forward, Forward, Go. The robot finishes on the treasure square, facing right. The plan in words is the algorithm, and the list of commands is the program.

Common mistakes and how to help

Thinking the robot or computer thinks for itself

Devices seem clever, and children see them respond quickly and talk back.

What helps: Keep asking, “What did we tell it to do?” Remind your child that someone had to write every action it takes.

Thinking the Right command moves the robot one square to the right

It is natural to think Right means “go that way”, but on a floor robot it only turns the robot to face right. The move comes from the next Forward.

What helps: Let your child be the robot. Stand where the robot would be, turn on the spot when told Right, and then take a step only when told Forward.

Using “algorithm” and “program” to mean the same thing

Adults often use them loosely, and both involve a list of steps.

What helps: Ask, “Is this the plan or the version the machine can read?” The plan is the algorithm. The commands for a particular device are the program.

Pressing the buttons and expecting the robot to move straight away

On a tablet things happen as soon as you touch them. A programmable floor robot usually stores the commands until you press Go.

What helps: Use the phrase “tell it, then run it” each time. It keeps the building and the running separate in your child’s mind.

How to help at home

  • Arrow cards on the floor. Make cards from scrap paper showing forward, turn left and turn right. Your child lays out a program on the floor and you act as the robot, doing exactly what the cards say, no more and no less.
  • Say the plan three ways. Choose a short journey in the house, such as the sofa to the kitchen door. Ask your child to describe it in words, then draw it as arrows, then lay it out as command cards. Discuss which version a machine could use.
  • Find the programs around you. Look for things that follow stored steps: a washing machine with different settings, a toy that plays a tune when you press a button, a car park barrier. Ask, “Who decided what it does?” The answer is always a person.
  • Plan before touching the device. If your child has a programmable toy or block-based tool at school or home, ask them to say or draw the plan first. Programming goes better after a plan than after random button pressing.
  • Let them correct you. Deliberately mistranslate a plan, for example by pressing Right when you meant to go forward. Your child gets to spot that the device did what it was told, which strengthens the idea that the program is the thing to fix.

More on algorithms and programming

Everything in Key Stage 1 computing

Updated .