Intro to Computer Science / Unit 3: Algorithms and Problem Solving
3.2 Decomposition and Abstraction
Notes
Decomposition means breaking a big problem into smaller parts that are easier to solve. Abstraction means hiding unneeded details and focusing on what matters.
- Example: to build a quiz app, decompose it into: show a question, read the answer, check it, keep score, show the final result.
- Each part can be written and tested on its own, and different people can work on different parts.
- Pattern recognition means noticing steps that repeat so they can be reused.
- Abstraction example: a subway map shows stations and lines but not real distances or street details.
Practice
What is decomposition?
Decomposition splits a large problem into smaller sub-problems.
A team is building a weather app. Which is an example of decomposing the problem?
Splitting the app into smaller tasks is decomposition.
A map app shows roads and landmarks but hides things like individual trees and house paint colors. This is an example of:
Abstraction removes unneeded details to focus on what matters.
Ready for more? Take the Unit 3 test.