01.01.2015 Views

UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory

UML Weekend Crash Course™ - To Parent Directory

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.

Session 10—The Class Diagram: Associations 107<br />

Person Owns Car<br />

Person Drives Car<br />

Car Rents Person<br />

Figure 10-1<br />

Directional notation for association names<br />

Tip<br />

Remember the direction indicator when you’re making a lot of changes to a<br />

diagram where you have to rearrange the classes. It is easy for classes to<br />

reverse position on the diagram, resulting in nonsensical association names.<br />

The indicators can prevent unnecessary confusion.<br />

Association multiplicity<br />

The <strong>UML</strong> allows you to handle some other important questions about associations: “How<br />

many Cars may a Person own” “How many can they rent” “How many people can drive a<br />

given Car” Associations define the rules for how objects in each class may be related. So<br />

how do you specify exactly how many objects may participate in the relationship<br />

Multiplicity is the <strong>UML</strong> term for the rule that defines the number of participating objects.<br />

A multiplicity value must be assigned to each of the participating classes in an association.<br />

As illustrated in Figure 10-2, you need to ask two separate questions.<br />

Person<br />

Owns<br />

Car<br />

How many<br />

People own<br />

each Car<br />

How many Cars<br />

are owned<br />

by each Person<br />

Figure 10-2<br />

Assigning multiplicity to each end of an association

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

Saved successfully!

Ooh no, something went wrong!