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
1) One to one; 2) one to zero or more; 3) one to one or more; 4) one to four; 5) one to 6 to 10 inclusive, 6) one to two or four or six, 7) one ore more to zero or more

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.
AMP Image 2
  1. Role: Must have a name or roles or both
  2. "Association name: Must have a name or roles or both"
  3. Role: Must have a name or roles or both
  4. Class
  5. Constraint: Optional
  6. Multiplicity: Required
  7. Association
  8. Multiplicity: Required
  9. Class

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