Menu

Abstraction and Decomposition

Computational Thinking

Computational thinking is a way of approaching a problem so that a computer can help solve it. Two of its main techniques are decomposition, which breaks a problem into smaller parts you can tackle one at a time, and abstraction, which removes or hides detail you do not need so you can focus on what matters. You use both together as you analyse a problem, design a solution and implement it in code.

Imagine you have been asked to write a program for sports day that turns event results into a house leaderboard.

Structure diagram splitting the sports day leaderboard program into reading results, scoring each event, adding up house points and displaying the leaderboard, with amber notes on what abstraction keeps for two of the parts.

StageDecompositionAbstraction
AnalyseSplit the job into reading results, scoring each event, adding up each house's points and displaying the leaderboard.Decide a result only needs the school house and the finishing position; names, ages and race times are irrelevant to the points.
DesignPlan each part separately and agree what information each one takes in and hands back.Model a school house as just a name and a points total, rather than everything about that house.
ImplementWrite and test one part at a time, then combine the tested parts.Store a simple list of houses and their points, not a full record of the whole day.

The techniques support each other: breaking the problem down gives you small pieces that are easy to simplify, and simplifying each piece makes it clearer how the parts fit together. You might sketch the breakdown as a structure diagram, then simplify each part before writing it. Working this way through analysis, design and implementation keeps the solution focused on what the program actually needs to do.

Practise this