Concept: Association


Contents

  1. Introduction
  2. Definition
  3. Describing a Binary Association
  4. Describing a Ternary Association
  5. Identifying Associative Classes
  6. Using Roles in Associations
  7. Using Aggregates
  8. Example

1. Introduction

The concept of association is used in describing relationships between entities in an entity relationship model or classes in an object model. The basic concept is the same regardless of the type of modeling technique being used. For the purposes of consistency this concept description uses the object oriented modeling term "class" for the "things" being related.


2. Definition

Association between two classesAn association describes a relationship between two classes of object that must be remembered by a system. For example, in a complaint management system an incident triggers a complaint. The system must remember which complaints were triggered by which incidents. Associations can also encapsulate the basic business rules of an organisation. For example an insurance claim must be associated with an insured person.

The vast majority of associations involve two classes (binary) but on occasion can involve three (ternary) or more. Where possible all associations should be decomposed into binaries as ternaries and above are difficult to conceptualize.


3. Describing a Binary Association

In a binary association is fully described by indicating:

In the complaint management example the association between incident and complaint is fully described by:

Note that the association names are read from the model in a clockwise direction.

Cardinality

Cardinality is expressed in terms of:

Examples of cardinalityOptionality is expressed in terms of:

Two classes may have more than one relationship. For example:

relationship 1 a doctor treats a patient
a patient is treated by a doctor
relationship 2 a doctor invoices a patient
a patient is invoiced by a doctor


4. Describing a Ternary Association

Ternary associationA ternary association describes a fact that involves three classes and cannot be split up into component binary associations without losing information. For example, when a seller negotiates a price with a buyer through an agent, a decomposition of the ternary into two binary associations between buyer and seller and seller and agent would lose the information on which buyer was involved in the deal between the seller and agent.

A ternary association is described in terms of the role that each class plays in the association. For example:


5. Identifying Associative Classes

Associative classAssociative classes are used when it is useful to keep information about the association itself. For example when a customer purchases a book, information on the actual purchase does not belong with the customer or the book, it is a class in itself. We therefore create the class purchase.

Associative classes are common in many to many associations.


6. Using Roles in Associations

Using roles in associationsRole names describe the role played in an association by a class. Using role names adds clarity to the model. For example, when a person manages other persons in a team it is useful to indicate the two roles played in the association by the same class. In the case of a team leader/team member association a person who plays the role of team leader manages zero, one or many persons who play the role of team member.


7. Using Aggregates

Aggregates provide a shorthand method of modeling associations between objects when they are the components of an assembly.

Recursive aggregatesRecursive Aggregates

A recursive aggregate contains an instance of the same kind of aggregate. For example, a computer program is an aggregation of blocks with optionally recursive compound statements; the recursion terminates with simple statements. Blocks can be nested to arbitrary depth.

 


8. Example


Software Engineering Web -
Copyright
ã 1997 Chambers & Associates Pty Ltd
Module: 104 v1.0 c_assocn.htm
Updated: July 02, 2006