Abstraction
Principle of managing complexity by hiding details behind simpler interfaces, so a component can be used without knowing how it works inside.
Abstraction in computing means representing something in terms of what it does while hiding how it does it. A programmer who calls a function to sort a list need not know which sorting algorithm it uses, just as a driver turning a steering wheel need not understand the linkage beneath. Each abstraction offers an interface, a set of operations and promises, and conceals an implementation that can change without affecting its users. Functions, modules, classes, APIs and file systems are all abstractions, and so are high-level programming languages themselves.
Computing is built from layers of abstraction. Transistors form logic gates, gates form processors, processors run machine code and compilers translate high-level languages into that code. Operating systems, in turn, present files and processes instead of disk sectors and hardware interrupts. Each layer lets people work without holding the details of the layers below in their heads. David Parnas's 1972 paper on decomposing systems into modules, which argued for information hiding, and Barbara Liskov's work on abstract data types in the 1970s gave software engineering systematic ways to decide what each module should hide.
Good abstractions extend what people can build: they let finite human minds build systems far too large to understand in full. They also have costs. Joel Spolsky's law of leaky abstractions observes that hidden details tend to surface when things go wrong, for example when a network failure breaks the illusion that a remote call behaves like a local one. Excessive abstraction, with layers that add indirection but no clarity, makes code harder to follow. Choosing what to expose and what to hide is a central judgment in software design, shaping design patterns and Object-Oriented programming.
Key points
- An abstraction exposes what a component does through an interface and hides how it is implemented.
- Computing is a stack of abstractions, from transistors and logic gates up to programming languages and applications.
- David Parnas and Barbara Liskov helped formalize information hiding and abstract data types in the 1970s.
- Leaky abstractions expose hidden details when they fail, so understanding lower layers remains valuable.
Related entries
Object-Oriented Programming
Programming paradigm that organizes software around objects, which bundle data with the methods that operate on it and interact by sending messages.
API
Defined set of rules and interfaces through which one piece of software can request services or data from another without knowing its internals.
Design Pattern
Reusable, named solution to a commonly recurring problem in software design, described as a template rather than as finished code.
Software Library
Collection of prewritten, reusable code, such as functions and classes, that programs call on to perform common tasks without reimplementing them.
Operating System
System software that manages a computer's hardware resources and provides common services and interfaces for the programs that run on it.
Barbara Liskov
American computer scientist whose work on data abstraction, the CLU language and fault-tolerant distributed systems shaped modern programming practice.
Data Structure
Way of organizing and storing data in a computer so that it can be accessed and modified efficiently, such as an array, list, tree or hash table.
Featured in guides
Referenced by
Other entries that discuss or point to Abstraction.