Leaky abstraction
A leaky abstraction is an abstraction whose behavior, limitations, or interface exposes details of its underlying implementation to its users.
Functional Design and Architecture: Examples in Haskell
A leaky abstraction is an abstraction whose exposed behavior or interface reveals details of its underlying implementation.
- How it is used
- Uses leaky abstraction to assess whether design tools reduce complexity or expose implementation details.
- How deep it goes
- Defines leakage and describes its effects on client code and refactoring without a detailed implementation walkthrough.
- Examples
- Uses C++ templates as a fragile layering example and considers Haskell abstractions inspired by category theory.
- What you can do after
- Evaluate abstractions for exposed implementation details, resistance to change, and added complexity.
Read how Functional Design and Architecture: Examples in Haskell explains leaky abstraction →
Machine Learning System Design
A leaky abstraction is an abstraction that exposes underlying implementation details that its interface is intended to hide.
- How it is used
- Guides ML API design toward simple, predictable interfaces that hide implementation complexity.
- How deep it goes
- Defines leakage and contrasts parameter-heavy interfaces with redesigned prediction functions, but stops short of general API instruction.
- Examples
- Uses prediction functions whose interfaces expose or hide time, random seed, and model version.
- What you can do after
- Apply it by designing ML APIs with fewer parameters, explicit defaults, and controlled access to implementation details.
Read how Machine Learning System Design explains leaky abstraction →
Practices of the Python Pro
A leaky abstraction is an abstraction whose underlying implementation details or concerns escape into code that should depend only on its interface.
- How it is used
- Diagnoses coupling that appears when supposedly high-level code depends on implementation details or presentation concerns.
- How deep it goes
- Defines the pattern and traces it through HTTP errors, database operations, user messages, and application layers.
- Examples
- Uses requests.get error handling and a bookmark command that writes to a database and returns a user-facing message.
- What you can do after
- Diagnose coupling by locating low-level operations, package-specific errors, and presentation concerns in high-level code.
Read how Practices of the Python Pro explains leaky abstraction →
Grokking Software Architecture
A leaky abstraction is an abstraction whose underlying implementation details or limitations remain observable to its users.
- How it is used
- Uses ORM behavior to show why database implementation details remain relevant despite abstraction.
- How deep it goes
- Works through projection and client-side evaluation failures, but does not detail ORM internals.
- Examples
- Uses a 5MB profile image, a custom age-calculation query, and fetching data in a loop.
- What you can do after
- Diagnose ORM query failures and reduce unnecessary data fetching with projections, translatable logic, or explicit in-memory calculation.
Read how Grokking Software Architecture explains leaky abstraction →
Also covered in
What to know first
- abstractionAbstraction is a simplified representation that preserves relevant properties or behavior while omitting details unnecessary at a given level or for a given purpose.
- HTTPHTTP is an application-layer protocol that defines request-and-response communication for transferring resource representations and related metadata between networked systems.
- SQLSQL is a standardized declarative language for defining, querying, and manipulating data in relational database systems.
Related concepts
- abstractionkind of · Abstraction is a simplified representation that preserves relevant properties or behavior while omitting details unnecessary at a given level or for a given purpose.
- business logiccontrasts with · Business logic is the domain-specific rules, computations, and decisions that determine how a software system processes operations and behaves.
- refactoringcontrasts with · Refactoring is the disciplined restructuring of existing software to improve its internal qualities while preserving its externally observable behavior.
- couplingcontrasts with · Coupling is the degree of interdependence between software components, including their dependencies on one another’s structure, behavior, or availability.
Questions about leaky abstraction
What is leaky abstraction?
A leaky abstraction is an abstraction whose behavior, limitations, or interface exposes details of its underlying implementation to its users.
Which Manning books explain leaky abstraction?
Functional Design and Architecture: Examples in Haskell, Machine Learning System Design, Practices of the Python Pro and Grokking Software Architecture.
What should I know before learning leaky abstraction?
Manning books that teach leaky abstraction usually introduce abstraction, HTTP and SQL first.
What is the difference between leaky abstraction and business logic?
A leaky abstraction is an abstraction whose behavior, limitations, or interface exposes details of its underlying implementation to its users. Business logic is the domain-specific rules, computations, and decisions that determine how a software system processes operations and behaves.
What is leaky abstraction a kind of?
Leaky abstraction is a kind of abstraction. Abstraction is a simplified representation that preserves relevant properties or behavior while omitting details unnecessary at a given level or for a given purpose.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



