Abstraction Formula

Abstraction is focusing only on the essential information needed to solve a problem while ignoring irrelevant details.

The Formula

model=essential details−irrelevant details

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

A map abstracts the world—shows roads, hides individual houses. A function name hides the code inside.

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

Abstraction defines a mapping from a concrete domain D to a simplified domain D′ that preserves the properties relevant to the problem while discarding implementation details.

Worked examples

Example 1

medium
A map of the London Underground is an example of abstraction. Explain what details are kept and what is removed.
Show solution

Answer

The Tube map keeps connectivity and line information but removes geographic accuracy. This makes it easier to plan journeys.

First step

1.
Step 1: Details kept: station names, line colours, connections between stations, order of stations.

See the full worked solution + why-it-works coaching

SetupKey insightWhy it worksCommon pitfallConnection

Free: full solutions on 3 topics a day. No card.

Every topic, every day: the Family plan

Example 2

medium
A function `calculateArea(length, width)` returns `length * width`. Explain how this is an example of abstraction.

Example 3

medium
A `User` object exposes `getEmail()` but stores email in a private field. Why is direct field access discouraged?

Common 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.