Menu

Computational Thinking

Abstraction

Abstraction means setting aside the parts of a problem that do not affect the answer, so you can give your attention to the parts that do. It does not mean removing every detail or making the problem vague: if a climbing-wall program ignored the route number, it could not say which route was climbed, so the solution would fail. Keep enough detail for the solution to work and ignore the rest.

Choosing which details matter

Deciding what to leave in is a key part of abstraction. You keep a detail only when the finished solution depends on it. Imagine a program for a climbing wall that records the routes each climber has finished.

Detail in the real worldKept or ignoredWhy
Membership numberKeptThe program must know whose record it is
Route numberKeptThe record has to say which route was climbed
Date the route was climbedKeptThe record shows when each route was finished, and results are shown in date order
Hair colourIgnoredNothing in the solution uses it
Brand of climbing shoesIgnoredIt makes no difference to which routes were finished

Structure diagram splitting the sports day leaderboard program into reading results, scoring each event, adding up house points and displaying the leaderboard, with amber notes on what abstraction keeps for two of the parts.

Stand-ins for real things

Abstraction also includes representing real things with simpler models. A variable such as lives in a game is a simpler model of the player's remaining lives: it holds a number and nothing else about the player. Creating that stand-in is abstraction, not decomposition, because nothing has been split into smaller parts; the real thing has been swapped for something the program can work with more easily.

Practise this