Whenever an app has to manage the data of more than one object type,
it is very likely that there are associations between some of them. For instance, in the following class
diagram, there is an association between publishers
and
books
and an association between books
and
people
as authors.
An association between two classes can be read in both directions.
The association between publishers
and books
associates
the books published by a publisher with this publisher, as
indicated by the association end name published
books
,
inversely (from right to left), the publisher of a book with this book.
The association between books
and people
as authors associates
the authors of a book with this book, as indicated by the
association end name authors
,
inversely (from right to left), the books authored by a person
with this person, as indicated by the association end name
authored books
.
As will be discussed in Volume 2, associations are characterized by
multiplicity constraints, which restrict the possibilities of how many
objects of the associated class can be linked to an object of the given
class. In our example, we have a one-to-many association between
publishers
and books
and a many-to-many association between
books
and people
.
For keeping things simple, we only include one object type and no association in the apps discussed in this volume of the book. In Volume 2, we will discuss how to model associations and how to implement them.