Abstract Data Type¶
Core Idea¶
Specify a component by its externally observable behaviour — the contract — while suppressing how it does it, so any conforming implementation is interchangeable from the outside. Clients depend only on the contract; the contract is the role, the implementation the occupant.
How would you explain it like I'm…
The Remote Control Trick
The Vending Machine Promise
Contract, Not Contents
Broad Use¶
- Software engineering: the origin — behavioural specification of components, with interfaces, protocols, and abstract base classes as the implementing mechanisms.
- Legal and political systems: the office is specified by powers and duties while the incumbent is interchangeable; succession is substituting an occupant behind a stable contract.
- Organisational design: a job description separates the role (deliverables, decision rights) from the incumbent, so the organisation survives departures.
- Biology: an enzyme's functional role is specified by the reaction it catalyses, with multiple distinct molecules conforming to the same contract.
- Standards and protocols: a specification states what a conforming implementation must do without prescribing how, leaving implementations interchangeable.
- Mechanism design: a mechanism is specified by its function, independent of the institution that instantiates it.
Clarity¶
Forces the load-bearing question "is this requirement on the contract or the implementation?" and exposes a substitution diagnostic: swap a conforming occupant, and if a client breaks it depended on a leak.
Manages Complexity¶
Compresses interface design, contract completeness, hidden coupling, and leaky abstractions into one family — behavioural contract separated from substitutable implementation — with a small menu of moves on the boundary.
Abstract Reasoning¶
Supports reasoning about the substitutability guarantee, the leaky-abstraction failure mode, and the contract-evolution problem (deprecation, versioning, backward compatibility) shared across interfaces, statutes, and protocols.
Knowledge Transfer¶
- Software to institutions: the office-versus-officer split transfers into constitutional and corporate design, where succession rules and impeachment all rely on the role-versus-incumbent boundary.
- Biology to pharmacology: the function-versus-mechanism split transfers into drug design, where targets are specified by functional role and candidates evaluated against the functional contract.
Example¶
A stack's LIFO laws are the contract; an array or linked-list internal is the suppressed implementation, so swapping one for the other leaves every contract-only client unaffected.
Relationships to Other Abstractions¶
Current abstraction Abstract Data Type Prime
Parents (2) — more general patterns this builds on
-
Abstract Data Type presupposes, typical Information Hiding Prime
Abstract Data Type typically presupposes Information Hiding, whose structure must already obtain for the child mechanism to be meaningful or operational.
-
Abstract Data Type presupposes Interface Prime
An ADT 'includes the interface but is richer' — a behavioural contract (interface signatures PLUS invariants/laws) with a conformance relation and substitutability guarantee.
Children (5) — more specific cases that build on this
-
Container (type theory) Domain-specific is a kind of Abstract Data Type
The proposed strict upward parent is
prime:abstract_data_type. -
Graph Data Type Domain-specific is a kind of Abstract Data Type
A graph data type is an abstract data type specialized to node-edge traversal, mutation, and query contracts over swappable representations.
-
Object-Oriented Operating System Domain-specific is a kind of Abstract Data Type
The minimal prospective placement is an instantiation of
prime:abstract_data_type. -
Object-Oriented Programming Domain-specific presupposes, typical Abstract Data Type
Abstract Data Type is the proposed minimal parent through a typical composition/presupposition relation.
-
Substitutability Prime decompose Abstract Data Type
Substitutability is the consequence/dividend the ADT apparatus produces and disciplines ('Substitutability names the dividend; the ADT names the whole machine that pays it').
Hierarchy paths (3) — routes to 2 parentless roots
- Abstract Data Type → Information Hiding → Abstraction
- Abstract Data Type → Information Hiding → Boundary
- Abstract Data Type → Interface → Boundary
Not to Be Confused With¶
- Abstract Data Type is not Substitutability because substitutability is the consequence (conforming implementations are interchangeable) whereas the ADT is the full apparatus (contract, conformance, contract-only dependence) that produces and disciplines it.
- Abstract Data Type is not Interface because an interface is the boundary signature whereas the ADT adds the behavioural invariants, conformance relation, and prohibition on depending past the contract.
- Abstract Data Type is not Information Hiding because information hiding is the principle of concealing what changes whereas the ADT is the structural pattern that operationalises it into a role-versus-occupant split.