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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Session 11—The Class Diagram: Aggregation and Generalization 125<br />

Dog<br />

Collie Spaniel Setter<br />

Figure 11-7 Steps 1 and 2: Draw the starting superclass and the first set of specialized<br />

classes (subclasses).<br />

Step 2: Identify the discriminator for the first level of differentiation or specialization.<br />

In this example I chose breed. List the possible values for the discriminator. Identify<br />

what distinguishes the values from one another using the five objective criteria I<br />

described earlier in “Elements of generalization.” Then create a class for each value.<br />

In Figure 11-7, I broke Dog down into the breeds (discriminator) Collie, Spaniel, and<br />

Setter.<br />

Step 3: Connect all the Breed subclasses to the Dog superclass using the generalization<br />

relationship, a line with the triangle at the superclass end of the line (see Figure<br />

11-8). Place the discriminator label on the line. It doesn’t really matter where exactly,<br />

as long as it is between the superclass and subclasses. Other analysts are going to<br />

look at my diagram and wonder why I chose this set of subclasses. In any given<br />

problem there might be quite a few different ways to organize the information.<br />

Dog<br />

Discriminator<br />

Breed<br />

Collie Spaniel Setter<br />

Figure 11-8 Step 3: Draw the generalization relationship.<br />

Step 4: The process continues by repeating the steps for each new subclass I create.<br />

In Figure 11-9, I have expanded only the Spaniel subclass.

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

Saved successfully!

Ooh no, something went wrong!