Decomposition Detective
Every big program starts as one scary problem. Learn to break it down, strip out the noise, and turn each piece into a subprogram you can test on its own.
Revise this, the fun way
Play it interactively, earn XP and build a streak, free.
Start revising freeWhat you'll cover
Decomposition Detective 🕵️
A whole program can look impossible when you stare at it all at once. Good programmers never do that. They use two habits of mind to make any problem manageable. Those habits are **decomposition** and **abstraction**. Master them and you can pick apart any problem like a detective.
Decomposition 🧩
**Decomposition** means breaking a large, complex problem into smaller, more manageable **sub-problems**. Each smaller part is easier to understand, to solve and to **test on its own**. Different parts can even be worked on by different people at the same time. Solve every piece and you have solved the whole.
Abstraction 🎭
**Abstraction** means hiding or removing **unnecessary detail** so you can focus on what really matters. A map is a good example: it leaves out every tree and lamppost and just shows the roads you need. In code, you might think about "a button the user can click" without worrying yet about its exact colour or size.
Name the technique
A programmer ignores the exact colour and size of every button and just thinks about "a button the user can press". Which technique is this?
- Abstraction
- Decomposition
- Iteration
- Compilation
Decomposing a quiz game
An interactive activity.
Match each term to its meaning
- Decomposition
- Abstraction
- Subprogram
- Breaking a problem into smaller sub-problems
- Hiding or removing unnecessary detail
- A named block of code that does one task and can be reused
A school login
An interactive activity.
Detective summary
_____ means breaking a big problem into smaller sub-problems that are easier to solve and test. _____ means hiding unnecessary detail to focus on what matters. Writing each sub-problem as a _____ lets you test and _____ the code independently.