29.11.2014 Views

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

Smalltalk and Object Orientation: an Introduction - Free

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.

Micro<br />

Computer<br />

1..<br />

*<br />

Monitor<br />

System<br />

Box<br />

Mouse<br />

Keyboard<br />

Figure 17.9: Aggregation tree notation<br />

A qualified association is <strong>an</strong> association which requires both the object <strong><strong>an</strong>d</strong> the qualifier to uniquely<br />

identify the object involved in the association. It is represented as a box between the association <strong><strong>an</strong>d</strong> the<br />

class. For example, in Figure 17.10, it is necessary to use the catalog <strong><strong>an</strong>d</strong> the part number to identify a<br />

unique part. Note that the qualifier is part of the association, not the class.<br />

Catalog<br />

partNumber<br />

1<br />

0..1<br />

Part<br />

Figure 17.10: Qualified associations<br />

Ternary (or indeed higher order) associations are drawn as diamonds with one line p ath to each of<br />

the participating classes (for example see Figure 17.11). This is actually the traditional entity -<br />

relationship model symbol for <strong>an</strong> association (the diamond is omitted from the binary form to save<br />

space). Ternary associations are very rare <strong><strong>an</strong>d</strong> higher order associations are almost none existent.<br />

However, the facility to model them is available.<br />

Project<br />

L<strong>an</strong>guage<br />

Person<br />

CAD : Project<br />

Java : L<strong>an</strong>guage<br />

Pheobe : Person<br />

Figure 17.11: Ternary Associations<br />

It is s ometimes useful to differentiate between by -value references <strong><strong>an</strong>d</strong> by -reference ones. This is<br />

done using the aggregation symbol. If the aggregation symbol is hollow, it indicates a by -reference<br />

implementation (i.e. a pointer or other reference); if the aggre gation symbol is filled, it indicates a by -<br />

value implementation, i.e. a class that is embedded within <strong>an</strong>other class (see Figure 17.12).<br />

Polygon<br />

1<br />

Contains 3..<br />

*<br />

{ordered}<br />

Point<br />

1<br />

GraphicsBundle<br />

1<br />

colour<br />

texture<br />

density<br />

Figure 17.12: Implementation adornment<br />

Inherit<strong>an</strong>ce of one class by a subclass is indicated by a solid line drawn from the subclass to the<br />

superclass with a large (unfilled) tri<strong>an</strong>gular arrowhead on the superclass end (see Figure 17.13). For<br />

143

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

Saved successfully!

Ooh no, something went wrong!