Grade 9 Computer Science · Abstraction
Naming a thing and forgetting the detail
What everything learned so far shares, and why it is one idea.
Seven things in mind, a million lines of code
A person can hold only a handful of things in mind at once, and yet people write programs of millions of lines and understand what they do. A better memory does not explain it. The explanation is one idea you have already used for three years — without anyone giving it a name.
For three years we have learned things that look different: functions, modules, data structures, protocols. Now it can be said what they all share — because they really are one idea, and it is the only one that makes it possible to build software of a size anyone actually uses.
| The abstraction | What it hides |
|---|---|
| A function | The lines inside it |
| A data structure | How the values are arranged in memory |
| A protocol | How the information actually travels |
Why without it nothing is possible
A person holds about seven things in mind at once. Real software contains millions of lines. That gap is not closed by a better memory or by concentration — it is closed by needing to hold in mind, at any given moment, only one layer: the names of what is beneath, and not their contents. Whoever writes a function using ten other functions holds ten names, not ten thousand lines. That is the whole trick, and there is no other.
Example 1 — why it is one idea
- Each of them has a name.
- Each has a promise of what it does.
- In each there is detail that was hidden.
- And the hiding is exactly the benefit.
Example 2 — how much is held in mind
- The function uses ten others.
- Each of them is a thousand lines.
- Whoever writes holds ten names.
- And not ten thousand lines.