4.1 What is an association?
In the previous section you learnt how to identify conceptual classes and their attributes from a requirements document.
In this section you will:
review what is meant by an association;
learn how to identify associations.
Just as a class can be thought of as a set of objects that have common attributes and behaviour, so an association between two classes is a set of links that have a common meaning. You have seen that a link is a connection between a pair of objects – one from each class – that is significant for the system domain. For example, in the DVD Library System, each object may be linked to a number of objects, with each link between a single object and a single object representing a connection between a film and a DVD. The situation at a particular point in time can be illustrated by an object diagram, such as the one in Figure 9.
Figure 9 Object diagram illustrating links between and objects
The links in Figure 9 each model the fact that the particular object at one end of the link represents a DVD which ‘is a copy of’ the film represented by the object at the other end. So these links are said to be instances of an association that we might call , which exists between the classes and .
As with classes and attributes, the name given to an association should be a single word and should give an indication of the meaning of the association. The usual convention is for association names to start with a lower-case letter. Note that the name of an association does not imply anything about its direction. This means that naming the above association (meaning a film is copied by a DVD) would have been just as valid as naming it (meaning a DVD is a copy of a film).