Logical View  «Prev  Next»
 Lesson 6 Modeling associations Objective Define the Notation for modeling Associations, including Naming, Roles, Multiplicity, and Constraints

Notation for modeling Associations

Naming, Roles, Multiplicity, and Constraints

A class can communicate only with another class it knows about, for instance, a class with which it is associated. To associate classes, use a line between two classes adorned with some qualifying elements.

Naming Associations

Remember how parts of speech map to elements in the models? Every association needs a name, an active verb that describes the relationship of one class to another class, such as "owns" or "opens."
Multiplicity: A number of objects of each class may be associated. For example, a customer may open many accounts, and an order may include many items. The number of participating objects is called the multiplicity, and it must be set for each end of the association. The notation for multiplicity is:
1. Asterisk (`*`) when used alone means zero or more, no lower or upper limit
2. Asterisk (`*`) when used in a range (`1..*`) means no upper limit
3. Values separated by two periods (`..`) means a range.
4. Values separated by commas means an enumerated list of values.

UML Design Foundations

Roles and constraints

When an association name is difficult to define, roles provide an alternative. A role name such as "supervisor" may be placed on one or both ends of the association. Finally, you can add constraints using the standard notation. Place the constraint on the end of the association that is being constrained.
In this example, you see two classes, Customer and Order. A customer may place zero or more orders, but an order cannot exist unless a customer places it. The customers placing the orders are preferred customers only, and orders they place are priority orders. The role names clarify the interpretation of the association between the two classes.

Customer Preferred Customer Modeling Associations
In the next lesson, you will learn more about associations.

Modeling Uml Associations - Quiz

Click the Quiz link below to take a short multiple-choice quiz on modeling associations.
Modeling Uml Associations - Quiz

UML Design Foundations