KeyStage

Key Stage 2 computing · Algorithms and programming

KS2 decomposition in computing: breaking problems into smaller parts

Decomposition means breaking a big problem into smaller, more manageable parts that can be solved one at a time. In Key Stage 2 computing, children use it to plan programs: instead of facing a whole game or animation at once, they split it into pieces, build and test each piece, and then put them together. It is one of the most useful thinking habits taught in the subject, and it works well beyond the computer.

Decomposition: breaking problems down, explained

The Key Stage 2 programme of study says pupils should solve problems by decomposing them into smaller parts. The word sounds technical but the idea is familiar. If you were asked to organise a birthday party, you would not try to do everything at once. You would split the job into the guest list, the invitations, the food, the games and the cake, and then work on each. In computing, children learn to do the same with programs, and they learn to say clearly what each part is for.

When a teacher sets a project such as “make a quiz” or “make a game where a character collects stars”, the first task is usually decomposition. Children list the parts on paper or on a planning sheet: a character that can move, stars that appear in different places, a score that goes up, a timer, and an ending. Each part is a smaller problem than the whole thing, and some can be broken down again. “A character that can move” becomes moving left, moving right and staying on the screen. Some schools show this as a tree diagram, with the big problem at the top and smaller problems branching below it.

Decomposition changes how children write and debug programs. They build one part, test it on its own and only then move on, so if something goes wrong, they know the fault is in the part they have just added. It also lets pupils working in pairs or groups share the jobs, and it lets children reuse a part they have already made. As projects get longer in Years 5 and 6, a child who plans in parts tends to find it much easier to finish than one who tries to build everything at once.

Children also use decomposition to understand algorithms and to reason about them. Faced with an unfamiliar program, they can ask, “What are the main parts, and what does each one do?” That makes a long set of instructions much easier to read and explain, and it is part of the logical reasoning that the curriculum asks for. Because it is a thinking skill rather than a coding skill, it supports problem solving in maths, design and technology and everyday life.

You do not need to understand any code to practise this with your child. Whenever a job feels big, ask, “What are the smaller jobs in this?” Most children find it easier than they expect, and the habit transfers well.

Words your child will hear

Decomposition
Breaking a big problem into smaller parts that are easier to solve.
Problem
A task or challenge that needs solving, such as making a game.
Sub-problem
A smaller part of a bigger problem.
Algorithm
A precise list of steps for completing a task.
Debug
To find and fix mistakes in a program.
Component
One part of a larger program or system, such as the scoring part of a game.
Test
To run a part of a program to check it does what it should.

What the National Curriculum says

The programme of study for Key Stage 2 says:

  • Pupils should be taught to design, write and debug programs that accomplish specific goals, including controlling or simulating physical systems; solve problems by decomposing them into smaller parts
  • Aim: pupils can analyse problems in computational terms, and have repeated practical experience of writing computer programs in order to solve such problems.

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

Try it: breaking down a star-collecting game

A child wants to make a game in which a cat character moves around the screen collecting stars for 30 seconds, with a score shown at the end. How can decomposition help?

  1. State the whole problem in one sentence. “Make a game where the player moves a cat to collect stars for 30 seconds and see their score.” This is too big to tackle at once, so we split it up.
  2. List the main parts: (1) the cat moves when keys are pressed, (2) a star appears at a random place, (3) when the cat touches a star, the score goes up and the star moves (with the score set to 0 when the game starts), (4) a 30-second timer, (5) the game ends and shows the score.
  3. Break down any part that is still big. Part 1 becomes four smaller jobs: move up, move down, move left and move right. Part 3 becomes: detect the touch, add 1 to the score, move the star.
  4. Put the parts in a sensible order and build the first one only. Make the cat move, run the program and test all four directions. Fix any problem before moving on.
  5. Add one part at a time, testing after each. Once the star and the score work together, add the timer and the ending last, because the game only needs to stop once everything else works.

The game is split into five parts (movement, the star, scoring, the timer and the ending), and the larger parts are split again. Building and testing one part at a time means any bug is easy to find, because it must be in the part just added.

Common mistakes and how to help

Thinking decomposition is just making a to-do list

Listing jobs is part of it, but children sometimes stop at a list of tasks without asking whether each task is small enough to do.

What helps: Ask, “Could you do this part in one go? If not, what are its smaller parts?” Keep splitting until each piece is something your child knows how to start.

Trying to build everything at once, then testing at the end

It is exciting to see the whole game, and testing feels like a delay. But when many parts are added at once, a bug can be anywhere.

What helps: Agree a rule of one part, one test. Let your child see how much faster it is to find a fault in a small, new section.

Believing the parts have to be built in the order the player meets them

Children assume the first thing the player sees, such as a title screen or a set of instructions, must be built first. They can spend the whole lesson on it and run out of time before the main game works.

What helps: Talk about which parts the others depend on. Movement usually comes before scoring, because the cat has to move before it can touch a star. Extras such as a title screen can wait until the main parts work.

Thinking it is only for computers

Children meet the word in computing lessons and do not see that it is a general method.

What helps: Use it for ordinary jobs such as tidying a bedroom, planning a picnic or writing a story. Name it when you do: “Let’s decompose this.”

How to help at home

  • Decompose a family job. Choose a task such as planning a picnic or packing for a holiday. Ask your child to list its parts, then split any big part again. Say aloud, “That is decomposition.”
  • Draw a problem tree. Put a big problem, such as “make a board game”, at the top of a page and draw branches for the parts underneath. Keep splitting until each branch is a small, doable job.
  • Describe a familiar object in parts. Choose something like a bicycle, a kitchen or a favourite game. Ask, “What are the main parts, and what does each one do?” This is how children learn to read other people’s programs.
  • Build one piece at a time. For a craft or construction project, agree to finish and check one piece before starting the next. When something goes wrong, you will know where to look.
  • Ask before the next coding project. When your child starts a new program, ask, “What are the parts?” Their answer shows you whether they have a plan, and gives you something to ask about as they work.

Leads on to

Everything in Key Stage 2 computing

Updated .