Finishing the Static Model - Associations - Reading Associations

5 important questions on Finishing the Static Model - Associations - Reading Associations

Associations can have names, independent of the names at the ends or the names of classes/types at the ends.

These names are usually a verb form such as found in Fig. 10.18.

The name used is “is authored by.” When you supply a name, it is best to write one that reads from left to right or top down.

When you read an association, always start with “one,” “a,” “an,” or “each” or something similar.

The multiplicity is only read on the target side. We ignore the multiplicity and adornments on the source side.

In Fig. 10.18, we are modeling the relationship from A Book to Many Persons and A Person to many Books.

How do we read this figure?

This reading is a consequence of the equivalence of an association to an attribute.

As an attribute is only the property of an instance, the association end on the target side is also only a property of an instance.

BookPerson: A Book is authored by an ordered set of many Persons in the role of author

When you read in the other direction, you generally will need to change the verb form from active to passive or vice versa.

PersonBook: A Person authors a set of many Books in the roles of myBooks

Another example of a reading direction

In Fig. 10.19, we named the association “authors,” the third person active form of the present of “to author.”

When we read in the other direction, we used “is authored by,” the passive form.

We also added another bit of notation, the reading direction indicator    < or >  .

This triangle points in the direction that the association name is intended to be read.

This indicator is useful in making the diagram more understandable.

However, it makes editing the diagram (such as changing the orientation of the association) more difficult as it may require a manual maintaining of the triangle direction.

See Table 10.4, for other properties allowed for an association.

It is certainly possible to have more than one association between two classes,

It is certainly possible to have more than one association between two classes, as shown in Fig. 10.20

How do we read this? 

We read each association independently.

However, starting at one class, the role names at the target classes must be unique.

The role names map to the attribute names when they are in the attribute format subject to the restriction that within a class’s namespace we cannot have two attributes with the same name.

It is ok to have blank role names, as the tools will generate some opaque string behind the scenes.

In the figure, the role names myBooks and myEdits must be different (which they are). Similarly, author and editor must be different (which they are).

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo
  • Higher grades + faster learning
  • Never study anything twice
  • 100% sure, 100% understanding
Discover Study Smart