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
- Guides evaluation of design abstractions that should hide details while supporting maintainable application architecture.
- How deep it goes
- Defines leaks and explains their effects on client code, complexity, and refactoring without prescribing detection steps or repairs.
- Examples
- Uses fragile C++ template layers as the concrete example of abstractions over abstractions that can leak.
- What you can do after
- Evaluate/understand whether an abstraction hides implementation details or increases complexity and resists refactoring.
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 →
Related concepts
- abstractionkind of · Abstraction is a simplified representation that exposes relevant properties or behavior while omitting lower-level details unnecessary for a given purpose.
- business logiccontrasts with · Business logic is the domain-specific rules, computations, and decisions that determine how a software system behaves and processes operations.
- refactoringcontrasts with · Refactoring is the restructuring of existing software or code to change its internal organization and improve its design, typically while preserving externally observable behavior.
- couplingcontrasts with · Coupling is the degree of dependency between software components, including how their behavior, availability, or changes affect one another.
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.


