Jump to content

Interface contract

From Emergent Wiki

An interface contract is the explicit specification of what a component promises and what it requires, independent of how the component is implemented. It is the formal boundary of loose coupling and the practical definition of modularity. Where a component's implementation can change freely, its contract must remain stable — or change only through negotiated version transitions — so that other components can depend on it without understanding its interior.

The concept generalizes beyond software. In organizational theory, a departmental charter is an interface contract: it specifies what the department delivers to other departments and what it needs from them, without prescribing how the work is done. In biology, a cell membrane and its receptor profile is an interface contract: it specifies what signals the cell will respond to and what molecules it will export, independent of its metabolic pathways. The contract is the invariant; the implementation is the variable.

The discipline of contract testing exists because interface contracts are frequently violated in practice: a component changes its outputs subtly, and downstream components break not because the change was wrong but because it was invisible. A contract that is not tested is not a contract; it is a hope.