23.07.2012 Views

Design Patterns Explained

Design Patterns Explained

Design Patterns Explained

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

36 Part I • An Introduction to Object-Oriented Software Development<br />

Indicating the<br />

number of things<br />

another object has<br />

the contained object's lifetime being controlled by its containing<br />

object. The appropriate use of constructor and destructor methods<br />

is useful here to help facilitate object creation and destruction.<br />

Figure 2-5 The Class Diagram with a Note.<br />

Notes in the UML.<br />

In Figure 2-5, there is a new symbol: the Note. The box contain ing<br />

the message "open diamonds mean aggregation" is a note. They<br />

are meant to look like pieces of paper with the right corner folded<br />

back. You often see them with a line connecting them to a<br />

particular class indicating they relate just to that class.<br />

Class Diagrams show the relationships between classes. With composition<br />

and aggregation, however, the relationship is more specifically<br />

about objects of that type of class. For example, it is true<br />

Airports have Aircraft, but more specifically, specific airports<br />

have specific aircraft. The question may arise— "how many aircraft<br />

does an airport have?" This is called the cardinality of the relationship.<br />

I show this in Figures 2-6 and 2-7.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!