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 Primes¶
Parents (2) — more general patterns this builds on
- Abstract Data Type presupposes, typical Information Hiding — The file: information_hiding is the principle; ADT is 'the structural pattern that operationalises the principle' into a role-vs-occupant split. ADT presupposes hiding. information_hiding is a candidate (CAND-R2-066-05).
- Abstract Data Type presupposes Interface — The file: an ADT 'includes the interface but is richer' — a behavioural contract (interface signatures PLUS invariants/laws) with a conformance relation and substitutability guarantee. ADT is built on interface.
Children (1) — more specific cases that build on this
- Substitutability decompose Abstract Data Type — The file: substitutability is the CONSEQUENCE/dividend the ADT apparatus produces and disciplines ('Substitutability names the dividend; the ADT names the whole machine that pays it'). substitutability is a major existing prime, so this is a produces/part-of, not a reparent.
Path to root: 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.