4.1 Abstraction and Abstraction Hierarchies

Key Takeaways

  • Abstraction reduces complexity by hiding details that are not needed at the current level and exposing only what is essential.
  • From lowest to highest abstraction: transistors, logic gates, circuits and processors, machine language, assembly language, high-level text languages, block-based languages and applications.
  • Machine language (binary instructions) is a lower level of abstraction than assembly language, which gives those instructions readable mnemonics.
  • Procedures, data types, APIs, files, and graphical interfaces are all abstractions: each lets you use something without knowing how it works inside.
  • Generalizing a solution means removing specific details, for example by replacing hard-coded values with parameters, so that one solution handles a whole family of problems.
Last updated: September 2026

Why abstraction is the foundation

ETS begins the Algorithms and Computational Thinking category with abstraction as a foundation of computer science. You are asked to:

  1. Identify, create, or complete the correct ordering, from low to high, of an abstraction hierarchy.
  2. Identify abstractions in context.
  3. Identify details that can be removed from a solution in order to generalize it.

An abstraction is a simplified representation that hides details you do not need at the moment. When you press the brake pedal, you use an abstraction of the braking system. When you call sort ( list ), you use an abstraction of a sorting algorithm. A good abstraction lets you think about what something does without knowing how it does it.

The layers of a computing system

Computer science is built as a stack of abstractions. Each layer uses the layer below it and hides that layer's complexity from the layer above.

Level (low → high)What lives hereWhat it hides
1. Transistors and physicsElectronic switches, voltagesSemiconductor physics
2. Logic gatesAND, OR, NOT, NAND built from transistorsHow transistors switch
3. Circuits and componentsAdders, registers, memory cells, the ALUGate-by-gate wiring
4. Processor (architecture)The instruction set a CPU executesCircuit layout
5. Machine languageBinary instructions, such as 10110000 01100001Circuit-level operation
6. Assembly languageMnemonics such as MOV, ADD, JMP that map almost one-to-one to machine instructionsBinary encoding
7. High-level text languagesPython, Java, C++, the ETS pseudocodeRegisters and instruction details
8. Libraries, APIs, and system softwaresort, print, file and network callsAlgorithm and device details
9. Block-based languages and applicationsScratch, Snap!, spreadsheets, browsersNearly all programming syntax

ETS's sample question on this topic lists four items: assembly language, block-based programming language, logic gate, and machine language. It asks for the order from highest to lowest abstraction. The answer is block-based language, assembly language, machine language, logic gate. The common trap is placing machine language above assembly. Machine language is closer to the hardware, so it is lower.

Read the direction carefully. Some questions ask "low to high" and others "high to low," and the answer choices usually include the reversed order.

Other hierarchies you may be asked to order

HierarchyLow → high
Databit → byte → number or character → string or array → record or object → file → database
Program structurestatement → block → procedure → class or module → library → application
Networks (Section 16.2)physical signals → frames → packets → segments → application messages
Storagedisk sectors and blocks → files → folders → file system

Identifying abstractions in context

When a stem asks which feature is an abstraction, look for something that gives a name to complexity so you can use it without the details.

AbstractionWhat it hidesExample
Procedure (procedural abstraction)The steps insideaverage ( scores ) returns the mean; the caller never sees the loop
VariableA memory addressscore instead of a numeric address
Data typeBit-level representationString, double, boolean
Data structure / abstract data typeHow storage is arrangedA queue's enqueue and dequeue operations, whatever the implementation
APIA library's implementationA weather API returns a forecast without revealing its models
FilePhysical disk blocks"report.docx" instead of block numbers
Graphical user interfaceCommands and system callsA "Save" button
Model or simulationReal-world detailA traffic model that ignores car color

Numbers, characters, and colors are themselves abstractions over bits. The same eight bits can be read as the number 65, the character 'A', or one channel of a color. Chapter 13 covers these representations.

Removing details to generalize a solution

A solution becomes more general when you remove details that are specific to one case. The most common method is parameterization: replacing a hard-coded value with a parameter.

A specific procedure that works for only one case:

void drawSquare50 ( )
    for ( int i ← 0; i < 4; i ← i + 1 )
        forward ( 50 )
        turn ( 90 )
    end for
end drawSquare50

A generalized procedure that works for any regular polygon:

void drawPolygon ( int sides, int length )
    for ( int i ← 0; i < sides; i ← i + 1 )
        forward ( length )
        turn ( 360 / sides )
    end for
end drawPolygon

Two details were removed: the fixed side length (50) and the fixed number of sides (4, with its 90-degree turn). Now drawPolygon ( 4, 50 ) draws the original square, and drawPolygon ( 6, 20 ) draws a hexagon.

When a stem asks which detail can be removed to generalize, pick the detail that is specific to one instance and not essential to the task, such as a particular number, name, color, or location. Keep the steps that every instance needs. In a school-bus routing problem, for example, you can ignore the color of the buses and the drivers' names. You cannot ignore the road connections and travel times.

Choosing the right level

Too little abstraction buries you in detail. A teacher explaining loops does not start with transistor voltages. Too much abstraction hides details that matter. A performance problem may require you to look below the procedure call to see that it contains a nested loop. Skilled problem solvers move up and down the hierarchy as the question requires.

Test Your Knowledge

Which list is ordered from lowest level of abstraction to highest?

A
B
C
D
Test Your Knowledge

A procedure computes shipping for orders sent only to one city, using that city's fixed rate of 0.07 written directly in the code. Which change best generalizes the procedure for all cities?

A
B
C
D
Test Your Knowledge

A student's program calls getForecast ( zipCode ) from a weather service and displays the result without knowing how the service computes forecasts. What does this best illustrate?

A
B
C
D