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.
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."
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 as follows:
Asterisk (*) when used alone means zero or more, no lower or upper limit.
Asterisk (*) when used in a range (1..*) means no upper limit.
Values separated by two periods (..) mean a range.
Values separated by commas mean an enumerated list of values.
An association describes discrete connections among objects or other instances in a system. An association relates an ordered list (tuple) of two or more classifiers, with repetitions permitted.
The most common kind of association is a binary association between a pair of classifiers. An instance of an association is a link. A link
comprises a tuple (an ordered list) of objects, each drawn from its corresponding
class. A binary link comprises a pair of objects. Associations carry information about relationships among objects in a system. As a system executes, links among objects are created and destroyed. Associations are the "glue" that ties a system together. Without associations, there are nothing but isolated classes that don’t work together.
A single object may be associated with itself if the same class appears more than
once in an association. If the same class appears twice in an association, the two instances
do not have to be the same object, and usually they are not. Each connection of an association to a class is called an association end. Most information about an association is attached to one of its ends. Association ends
can have role-names and visibility. The most important property they have is multiplicity, which is how many instances of one class can be related to one instance of the other class. Multiplicity is most useful for binary associations because its definition for n-ary associations is complicated. If the multiplicity upper bound is greater than one, the ordering and uniqueness of associated values may be specified on an association end.
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 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. The orders they place are priority orders. The role names clarify the interpretation of the association between the two classes.