Abstraction Formula
Abstraction is focusing only on the essential information needed to solve a problem while ignoring irrelevant details.
The Formula
Ask yourself: Does the problem carry details that do not change the answer, which you can leave out or hide behind a simpler model?
Quick example
What this formula means
Focusing only on the essential information needed to solve a problem while ignoring irrelevant details. Abstraction reduces complexity by creating simplified models that capture what matters and hide what does not, enabling reasoning at higher levels.
Abstraction is like packing your school bag for one day. You check the timetable and pack only what today's lessons need, leaving the rest at home. Pack too little and your maths book is missing; pack everything and the bag is too heavy to carry. A different day, like a different question, means packing differently.
Formal view
Worked examples
Example 1
mediumShow solution
Answer
First step
See the full worked solution + why-it-works coaching
SetupKey insightWhy it worksCommon pitfallConnection
Example 2
mediumExample 3
mediumCommon mistakes
- Over-abstracting and removing details that turn out to be important for correctness
- Under-abstracting and keeping so many details that the model is as complex as the original problem
- Confusing abstraction with vagueness—a good abstraction is precise about what it exposes and what it hides
Why this formula matters
Abstraction lets you solve hard problems without drowning in detail: a bus route map fits on one page, and a game can treat every enemy as just a position and a speed. Leave out the wrong detail, though, and the answer breaks, like a map that forgets a closed bridge. Keep everything, and the problem stays as messy as it was.
Frequently asked questions
What is the Abstraction formula?
Focusing only on the essential information needed to solve a problem while ignoring irrelevant details. Abstraction reduces complexity by creating simplified models that capture what matters and hide what does not, enabling reasoning at higher levels.
How do you use the Abstraction formula?
Use abstraction when a problem has extra details, when you are simplifying a real thing into a model (a map, a diagram, a game character), or when you want to hide the inside of something behind a simple name or button. Ask whether each detail could change the answer. If the job is to find what several examples have in common, use Pattern Recognition; if you need to break a big job into parts, use Decomposition.
Why is the Abstraction formula important in CS Thinking?
Abstraction lets you solve hard problems without drowning in detail: a bus route map fits on one page, and a game can treat every enemy as just a position and a speed. Leave out the wrong detail, though, and the answer breaks, like a map that forgets a closed bridge. Keep everything, and the problem stays as messy as it was.
What do students get wrong about Abstraction?
Too much abstraction loses important information; too little is overwhelming.