Posts

Showing posts from May, 2009

What is Design By Contract

Design by Contract is a trademarked term of BertrandMeyer and implemented in his EiffelLanguage as assertions. Design By Contract (DbC) is a software correctness methodology. It uses preconditions and postconditions (Contracts) to programmatically assert the change in state caused by a piece of a program. The Preconditions and Postconditions that are in demand in DbC could summarized by the "three questions" that the designer must repeatedly ask:     * What does it expect?     * What does it guarantee?     * What does it maintain? Some attributes of Design By Contract... Classes should specify their invariants: what is true before and after executing any public method. Methods should specify their pre- and post-conditions: what must be true before and what must be true after their execution, respectively. Pre-conditions may be weakened by subclasses and post-conditions may be strengthened. The explicit definition of these "assertions" forces the designer to th