UML Operation Contract
A UML Operation contract identifies system state changes when an operation happens. Effectively, it will define what each system operation does. An operation is taken from a system sequence diagram. It is a single event from that diagram. A domain model can be used to help generate an operation contract. The domain model can be marked as follows to help with the operation contract:
- Green - Pre existing concepts and associations.
- Blue - Created associations and concepts.
- Red - Destroyed concepts and associations.
Operation Contract Syntax
Name: appropriateName
Responsibilities: Perform a function
Cross References: System functions and Use Cases
Exceptions: none
Preconditions: Something or some relationship exists
Postconditions: An association was formed
When making an operation contract, think of the state of the system before the action (snapshot) and the state of the system after the action (a second snapshot). The conditions both before and after the action should be described in the operation contract. Do not describe how the action or state changes were done. The pre and post conditions describe state, not actions.
Typical postcondion changes:
- Object attributes were changed.
- An instance of an object was created.
- An association was formed or broken.
Postconditions are described in the past tense. They declare state changes to the system. Fill in the name, then responsibilities, then postconditions.
No comments:
Post a Comment