成人快手

What does decomposition mean?

Illustrated girl smiling with eyebrow slightly raised

Decomposition is when we break a problem or task down into smaller parts to make it easier to tackle.

Sometimes the problem is so big or so tricky that we don't know where to start.

Breaking it down or decomposing it can make it easier to manage.

Illustrated girl smiling with eyebrow slightly raised
Back to top

Breaking down everyday tasks

Organising books

We can use decomposition for every day problems and tasks.

Imagine you decide to organise all your books, comics and magazines. You start off thinking it will only take half an hour. You'll have the job done by dinner!

Once you start looking at all the books and comics piled up on the bookcase, and remember the box of magazines in the corner, you realise that this is going to be a much bigger job. But where to start?

Let's break down the problem into smaller parts using decomposition.

Organising books

Time to make a list

  1. Collect books, comics and magazines from all rooms and put them on the bed.
  2. Divide into piles of each type: Books, comics and magazines.
  3. Divide each pile into subject area.
  4. You could then sort out each pile again by:
  • putting magazines into date order
  • putting comics into character order
  • putting books into alphabetical order by title
Illustrated boy smiling after getting a question correct.

Once you can see the problem broken down into small tasks you can start to relax. Each smaller task will still take some time, but at least you know what to do first.

You might even be able to get friends and family to help with some of the jobs.

Time to make a start!

What everyday tasks and problems could you break down using decomposition?

Illustrated boy smiling after getting a question correct.
Back to top

Using decomposition to break down a computer programme task

We can use decomposition to help with a programming problem. We can break the problem down into smaller parts and think about the instructions needed to complete each part.

We can work on the smaller parts individually using by making sure we think sensibly about the problem and possible solutions.

Then we can organise the instructions into a sequence, or before translating it into for the .

Collecting power packs with the Bitesize Bot

Look at this example.

We have to write a program to control the Bitesize Bot. She needs to move around the shape maze and collect battery power packs as she goes. Then she can go home.

Bitesize Bot on a grid with different shaped obstacles.
Back to top

Time to decompose

The Bitesize Bot will need to travel forward and turn left or right several times on her journey. We can break the problem down into smaller parts:

  1. Collecting the first battery power pack
  2. Moving through the shape maze
  3. Collecting the second battery power pack
  4. Going home
Collecting power packs in shape maze broken in to four smaller tasks. One: collect the first power pack. Two: Move through shape maze. Three: collect second power pack. Four: Go to home.

Now we have decomposed the big problem into smaller ones, we can work on each one separately.

  1. Collecting the first power pack
  • The bot needs to move forward three squares
  • She then needs to collect the power pack
  1. Moving through the shape maze
  • The bot needs to turn right
  • She then needs to move forward three squares
  • Then turn left
Flowchart showing steps for collecting power packs in the shape maze. Collecting the first power pack: Step one - The bot needs to move forward three squares. Step two: She then needs to collect the power pack.  Moving through the shape maze. Step one: The bot needs to turn right. Step two: She then needs to move forward three squares. Step three: Turn left.
Back to top

Activity: Decomposition quiz

Back to top

Computing - Dance Mat Typing. game

Build and test your computing skills with different levels of touch type challenges

Computing - Dance Mat Typing
Back to top

More on Computer science

Find out more by working through a topic