An API contract defines how clients interact with a component: its available operations, their inputs and outputs, and the guarantees they provide. It separates what clients can rely on from how the component is implemented. section 1.1.2 section 2.4
Specify a data structure by moving from its public contract toward its implementation:
- List operations, focusing on their inputs and outputs. section 1.1.2
- Describe high-level behavior, then implementation details and method performance. section 1.1.2
- Keep client-facing guarantees distinct from internal invariants, data models, and algorithms. section 2.4
A shared service interface
An ordering service that works with multiple retailers needs a common API for placing orders; each retailer can use an adapter to connect its internal software to that interface. section 11.1.1
Table 2.1 API and contract for priority queue (view table figure)
A priority queue contract lists its methods and guarantees that the returned top element has the highest stored priority. section 2.4











































