AuthorsJ. W. Dzidek
TitleAutomated Contract Driven Development With UML's OCL
StatusPublished
Publication TypeTalks, contributed
Year of Publication2004
Location of TalkJavaZone website
Abstract

Design by Contract (DbC) allows for more powerful assertions since with the DbC framework assertions take the form of preconditions, postconditions, and class invariants. Preconditions specify something that must be true before a specific method executes, postconditions specify something that must be true after a specific method executes, and class invariants state something that must be true within a context of a specific class before and after any public method belonging to class executes. For example, in a Person class we may want to specify the invariant that the age attribute is never negative. If this is ever broken we ask the system to let us know by, for example, throwing an unchecked exception. Developing software with such a framework allows for developers to build better software by organizing the communication between software elements through specifying, the mutual obligations and benefits that are involved in those communications, where the specifications are the contracts. The benefit of DbC is said to be better designed software with improved reliability where the documentation is better, the debugging is easier, and support for reuse is better. The DbC concept is taken further in UML via OCL as contracts are expressed in higher-order logic and the contracts can be specified during analysis.

Citation KeyDzidek.2004.1