- Define decomposition
- Break a problem into smaller tasks
- Explain the benefits of decomposition
You know that computers follow algorithms step by step. Before writing an algorithm, you need to understand the problem.
Solve one part at a time
Big problems can feel impossible at first. Decomposition means splitting a problem into smaller parts. Each part is easier to think about and solve. When every part works, you can join them to solve the original problem. Teams can also share the work, with each person building a separate part.
Breaking a problem down into smaller, more manageable parts.
A smaller problem that forms part of a larger one.
Decomposing a game
A quiz game may sound like one large task, but it contains smaller ones: storing questions, showing a question, reading an answer, checking the answer, updating the score and showing the result. Each part can be built and tested on its own.
Decompose the task of creating a school website.
- Plan the pages that are needed.
- Write the content.
- Design the layout.
- Add photos and links.
- Test the website on different devices.
Answer: One large task is now five smaller tasks.
Keep breaking a problem down until each part is small enough to solve directly.
Practice
Quick check
What does decomposition do to a problem?
Why does decomposition help teams?
Which is a good subproblem of a quiz game?
- Decomposition breaks a problem into smaller parts.
- Smaller parts are easier to solve and test.
- Teams can work on different parts.
- Stop when each part is clear.
