Title :
Extending a method of devising software contracts
Author :
Mitchell, Richard ; McKim, James
Author_Institution :
Brighton Polytech., UK
Abstract :
Classes in object-oriented programs can be specified using assertions, specifically, preconditions and postconditions on individual methods and invariants on whole classes. Such assertions can be seen as forming a contract between a class and its client classes and, by extension, between the developers of class and the developers of client classes. In some programming environments, the contracts can be checked at runtime. A published method of devising contracts is applied to a small framework based on the observer pattern, raising a number of problems of writing contracts for a set of collaborating classes, rather than for individual classes such as those formed in data structure libraries. As well as providing an example of tackling such problems, the paper identifies desirable extensions to the method of devising contracts, to address aspects of performance (keeping the run-time cost of evaluating preconditions low); privacy (ensuring that one client of a class cannot discover the identities of other clients); extensibility (allowing subclasses to weaken preconditions without invalidating existing postconditions, and allowing subclasses to adopt different frame rules); and kinds of constraints (distinguishing physical and logical constraints)
Keywords :
object-oriented programming; programming environments; assertions; classes; data structure libraries; extensibility; object-oriented programs; observer pattern; performance; postconditions; preconditions; privacy; programming environments; runtime; software contracts; Collaborative software; Contracts; Costs; Electronic switching systems; Ferroelectric films; Libraries; Nonvolatile memory; Privacy; Random access memory; Runtime;
Conference_Titel :
Technology of Object-Oriented Languages and Systems, 1999. TOOLS 32. Proceedings
Conference_Location :
Melbourne, Vic.
Print_ISBN :
0-7695-0462-0
DOI :
10.1109/TOOLS.1999.809429