Decomposition
Decomposition is the process of breaking a complex problem down into smaller, more manageable sub-problems. Each sub-problem can be solved independently and then combined to solve the original problem. This is a core part of computational thinking.
Why Decompose?
- Large problems are overwhelming to tackle all at once
- Smaller problems are easier to understand, design, and test
- Different sub-problems can be worked on by different people simultaneously
- Sub-solutions can often be reused in other projects
- Errors are easier to locate when the problem is divided into parts
Decomposition Example
Problem: Build a school library management system
Decomposed into sub-problems:
- Manage member records (add, remove, update)
- Manage book catalogue (add books, update stock)
- Handle borrowing (issue books, set due dates)
- Handle returns (check book in, calculate fines)
- Generate reports (overdue books, most popular books)
Each sub-problem can be further decomposed — for example, "manage member records" becomes: add member, delete member, search for member, edit member details.
Abstraction
Abstraction is the process of filtering out unnecessary details and focusing only on the information that is relevant to solving the problem. It creates a simplified model of a real-world situation.
Why Use Abstraction?
- Real-world problems contain huge amounts of information — most of it irrelevant
- Abstraction lets you focus on what matters for the solution
- It makes problems simpler to think about and easier to model computationally
Abstraction Examples
| Real-world Object | Abstracted Model | Detail Removed |
| A car navigation system | Map of roads and junctions | Buildings, trees, road texture, colour |
| A student in a school system | Name, ID, year group, grades | Height, hair colour, hobbies |
| A library book | ISBN, title, author, available copies | Cover colour, page thickness, print font |
Abstraction in Programming
In programming, abstraction is used when:
- Writing a procedure or function — you call it by name without needing to know how it works internally
- Using a variable — you refer to the data by name without worrying about how it is stored in memory
- Designing a class or object — you interact with it through defined methods, hiding internal complexity
Decomposition vs Abstraction
| Concept | What it does | Key question it answers |
| Decomposition | Breaks problem into smaller parts | "What are the smaller tasks I need to complete?" |
| Abstraction | Removes irrelevant details | "What information do I actually need?" |
📝 Exam Tip: A common exam question asks you to "decompose" a given problem into sub-tasks and explain what information would be abstracted away. Show clear sub-problems and explicitly state what detail is not needed.
⚠️ Common Mistakes
- Confusing decomposition (breaking into sub-problems) with abstraction (removing detail)
- Giving only one level of decomposition — show that sub-problems can be broken down further
- Describing abstraction as "making things simple" without explaining what detail is removed and why