Eiffel Programming/Design by Contract

From Wikibooks, open books for an open world
Jump to: navigation, search

Design by Contract[edit]

One of the central tenets in the design of the Eiffel language, Design by Contract is the notion that every class can explicitly place constraints on its inputs (its requirements), state what it will provide (what it ensures) and its invariants (statements that are always true for the class).

In addition, Eiffel supports a rich set of assertion statements, ranging from validation of a loop construct, to a flexible debug mechanism, to inline checks on code validity.

See also the Wikipedia article on Design by Contract