| Lesson 10 | Basic object modeling: constraints |
| Objective | Constraints as they apply to basic object modeling. |
Any rules that cannot be expressed in the name or in the multiplicity may be added
as a constraint. Place the rule description within curly brackets {} at the end of the association controlled by the rule.
Constraints Example
In the previous example, we chose "a point in time" as our time frame. For this example, let's change the time frame to include history.
Now ask "How many customers can hold the same seat over the life of the system?"
In this case, the answer would be "only one at the same time, but many over a period of time."
This multiplicity would be represented as 0..*: zero to many customers may hold the same seat over time.
Now ask "How many customers can hold the same seat over the life of the system?"
In this case, the answer would be "only one at the same time, but many over a period of time."
This multiplicity would be represented as 0..*: zero to many customers may hold the same seat over time.
Use a multiplicity of 0..* and {only one at a time}.
Click the Exercise link below
to draw class diagrams based on excerpts from the course project problem statement.
Object Modeling Constraints - Exercise
Object Modeling Constraints - Exercise