You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
Decomposition is one of the four pillars of computational thinking. It involves breaking a complex problem down into smaller, more manageable sub-problems. Each sub-problem can then be solved individually, making the overall problem much easier to tackle. Decomposition is a fundamental skill in GCSE Computer Science and is used constantly in software development, systems design, and everyday problem-solving.
Large problems are difficult to solve all at once. By decomposing them, you can:
Exam Tip: When asked to decompose a problem in an exam, draw a decomposition diagram (tree diagram) showing the main problem at the top and the sub-problems branching below it. This is a clear and structured way to present your answer.
Follow these steps to decompose any problem:
Main problem: Organise a school charity event
| Sub-Problem | Further Decomposition |
|---|---|
| Choose a venue | Check availability, compare costs, book the venue |
| Plan activities | Decide on games, arrange entertainment, set up stalls |
| Manage finances | Set a budget, track spending, count donations |
| Promote the event | Design posters, send emails, post on social media |
| Arrange catering | Choose a menu, order food, set up serving area |
Each of these sub-problems is now much simpler to solve than the original problem.
In programming, decomposition is used to break a program into modules, functions, or procedures. Each function handles one specific task.
Main problem: Create a multiple-choice quiz
Decomposition:
Each of these can be written as a separate function or procedure:
FUNCTION displayWelcome()
OUTPUT "Welcome to the Quiz!"
END FUNCTION
FUNCTION askQuestion(question, options, correctAnswer)
OUTPUT question
FOR EACH option IN options
OUTPUT option
END FOR
INPUT userAnswer
IF userAnswer == correctAnswer THEN
RETURN TRUE
ELSE
RETURN FALSE
END IF
END FUNCTION
FUNCTION displayScore(score, total)
OUTPUT "You scored " + score + " out of " + total
END FUNCTION
This modular approach makes the program:
A decomposition diagram (also called a structure diagram or tree diagram) visually represents how a problem has been broken down. The main problem sits at the top, with sub-problems branching below.
Quiz Program
/ | \
Welcome Questions Results
/ | \ \
Display Load Ask Display
message file question score
|
Check answer
The same idea drawn as a mermaid subproblem tree:
graph TD
Q["Quiz Program<br/>(complex problem)"] --> W["Welcome"]
Q --> Qs["Questions"]
Q --> R["Results"]
W --> W1["Display message"]
Qs --> Qs1["Load from file"]
Qs --> Qs2["Ask question"]
Qs --> Qs3["Check answer"]
R --> R1["Track score"]
R --> R2["Display final score"]
Exam Tip: If you are asked to draw a decomposition diagram, make sure the main problem is at the top, the sub-problems are clearly labelled, and you show at least two levels of decomposition. Use neat lines to connect related items.
Decomposition is not limited to computer science. Here are some everyday examples:
In each case, the overall task is broken into stages that can be completed one at a time.
Decomposition is the process of breaking a complex problem into smaller, manageable sub-problems. It is essential for planning programs, working in teams, and solving real-world problems. In GCSE Computer Science, you should be able to decompose problems, draw decomposition diagrams, and explain how decomposition is applied in programming through the use of functions and procedures.
Decomposition is more than "chop a problem into bits". At AQA GCSE level it is the principal design technique you use to turn a vague requirement into a set of subroutines that can be coded, tested and maintained. Good decomposition gives a program low coupling (sub-problems depend on each other as little as possible) and high cohesion (each sub-problem does one clearly defined job). These two qualities are what make software easy to extend and cheap to fix.
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.