Databases Reference
In-Depth Information
Notice that Calculate Discount is an operation that applies to all products
because operations are inherited downwards in the same way that attributes are. In
fact, since there is nothing more said about the discount further down the hierarchy,
we conclude that the discount is calculated in the same way for all kinds of products.
On the other hand, the diagram indicates that the Calculate Extended Warranty Price
for TOOLs is performed differently for POWER TOOLs and for NON-POWER
TOOLs. The operation is initially specified in the TOOLs box but operation names
in the POWER TOOL and NON-POWER TOOL boxes indicate that it changes
in some way when it is inherited down to those boxes. Perhaps the presence of
an electric motor in the power tools requires a different kind of calculation. This
modification or refinement of operations as they are inherited downwards is called
polymorphism . (Note: technically, the operations that are performed differently
in the lower-level objects can have the same name—simply Calculate Extended
Warranty Price in this example—even though they will perform differently for the
different kinds of objects.)
Aggregation
Figure 9.4 shows the addition of the FRAME and BULBS classes, connected
to the LIGHT FIXTURE class with a diamond-shaped symbol. This is not
further generalization but is another type of relationship known as aggregation.
PRODUCT
Product Number
Product Name
Unit Price
Calculate Discount
Change Unit Price
TOOL
Weight
LIGHT FIXTURE
LUMBER
Type of Wood
Dimensions
Calculate Extended
Warranty Price
Add Lumber
POWER TOOL
Amperes
NON-POWER TOOL
Years of Warranty
FRAME
Weight
Dimensions
BULBS
Number of Bulbs
Watts per Bulb
Calculate Extended
Warranty Price
for Power Tools
Calculate Extended
Warranty Price for
Nonpower Tools
FIGURE9.4
General Hardware Company product diagram with aggregation
 
Search WWH ::




Custom Search