LARMAN CD MODULES

Module 7

Operation Contracts

Introduction

At this point in the CD Modules we looked at the Use Case Model, the System Sequence Diagram (SSD) and taken a tour of the Domain Model. This module on creating Operation Contracts relates contracts to the Domain Model and the Use Case Model.

What is a Contract?

The Big Idea:

The SSD depicts the input and output events while treating the system as a "black box". The details of what the system needs to do and what state needs to change may be clear from the Use Cases. However, this is not always the case. The Contract defines more details in terms of what the state of the world will be after a particular flow of execution. What world? the world described in the Domain Model.

Contracts are not that useful most of the time but sometimes we need to explore a particular Use Case in more detail. What we focus on in the contract is the post conditions. Post conditions describe the change in the state of the world.

There are a number of Post Conditions categories:

- instance created
- instance destroyed
- attribute modified
- association formed
- association broken

Note that Post conditions infers past tense speak. Therefore, an instance was created, an attribute was modified.

But We're not Talking Design Here:

At this point we are identifying, in finer detail than the Use Case, what state changes will occur after the particular flow of execution. We are not concerned with HOW we will get the state to change.

The Contract for Use Case Process Sale:

Larman has identified the Process Sale Use Case as a good candidate for a contract:

Artifact Influence Recap:

Interested in finding out more?

Bertrand Meyer promotes the design by contract method, using pre and post conditions and invariant specifications. Look for Design By Contract by Bertrand Meyer.

Home

Module 1 | Module 5 | Module 6 | Module 7 | Module 8 | Module 9

Module 10 | Module 12 | Module 13 | Module 14