An application programming interface defines the operations available to client code and their promised behavior, including inputs, outputs and failure cases. For a FIFO queue, operation names alone do not specify what happens on an empty or full queue. An API should state those cases before clients depend on them.
Circular buffer Created 2026-10-13 Updated 2026-10-18
A circular buffer stores a changing sequence in a fixed-capacity array, reusing slots by wrapping array indices through modular arithmetic. A front array index and an occupied count can represent a FIFO queue without shifting entries after removal. The physical array stays in place; the position at which its logical sequence begins moves. This makes a circular buffer useful when storage must remain bounded while successive items arrive and leave.
Capacity and overflow behavior are separate choices. A rejecting FIFO queue preserves all accepted items until removal and reports failure on a full insertion. An overwriting circular buffer deliberately discards its oldest item to retain the newest arrivals. These are different application programming interfaces. The existing representation independence example specifies the rejecting policy and gives its abstraction function and correctness argument against a shifting array implementation.
Software module 2026-10-13
A software module groups responsibilities behind an application programming interface. Its boundary can be maintained by procedures and hidden storage; it need not be a class in object-oriented programming. Information hiding guides which implementation decisions belong inside that boundary.