Computational Thinking
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.
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 world | Kept or ignored | Why |
|---|---|---|
| Membership number | Kept | The program must know whose record it is |
| Route number | Kept | The record has to say which route was climbed |
| Date the route was climbed | Kept | The record shows when each route was finished, and results are shown in date order |
| Hair colour | Ignored | Nothing in the solution uses it |
| Brand of climbing shoes | Ignored | It makes no difference to which routes were finished |
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.
OCR GCSE Computer Science · Computational Thinking