Adapted from a comp.lang.eiffel posting.
Class invariants express the fundamental integrity constraints on a class.
The notion of class invariant only makes sense in object-oriented design. In contrast, pre- and postconditions may also be used fruitfully in more traditional approaches. For me, invariants have been one of the most illuminating ideas in trying to understand and explain the methods of systematic software construction and object-oriented design . They would certainly figure high in my personal Pantheon of design and programming techniques. In the study of concurrent object-oriented programming, the notion of invariant is also crucial to understand the level of granularity to which one should apply mutual exclusion in object accesses.