13.11. Contracts, Operations, and the UML

Contracts in the UML: Operation Specifications

The UML formally defines operations. To quote:

An operation is a specification of a transformation or query that an object may be called to execute [RJB99]

For example, the elements of an interface are operations, in UML terms. An operation is an abstraction, not an implementation. By contrast, a method (in the UML) is an implementation of an operation.

A UML operation has a signature (name and parameters), and also an operation specification, which describes the effects produced by executing the operation; that is, the postconditions. The UML operation specification format is flexible, and does not have be the contract format shown in this chapter. However, ...

Get Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.