13.07.2015 Views

Object-Oriented Software Development with UML - UNU-IIST ...

Object-Oriented Software Development with UML - UNU-IIST ...

Object-Oriented Software Development with UML - UNU-IIST ...

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.

Generalisation 1410..1CashPaymentSaleTimedate111 0..1amount:MoneyCreditPaymentamount:Money0..1CheckPaymentamount:MoneyFigure 9.4: A ¿+ÀÁ[Æ can be paid by any of the payment methods1. There are too many distinct association (though they have the same name), one between each paymentmethod and the ¿+ÀÁ[Æ .2. The multiplicities in the model do not correctly capture the fact that a ¿+À§Á†Æ is paid by one and onlyone of the payment methods; and an instance of a Î À§ÍBÉdÆÅsÈ of any kind is to pay a ¿+ÀÁ[Æ instance.3. If a new kind of payment were introduced, a new association would also have to be added to themodel.4. The model does not explicitly show the similarities of the three concepts of payment methods whichprobably have a large amount of common structure.9.2.1 The notion of generalizationThese problems can be overcome by making use of the notion of generalization. Generalization is theactivity of identifying commonality among concepts and defining supertype and subtype relationships. Ina generalization-specialization relationship, one class is identified as a ‘general’ class and a number ofothers as ‘specializations’ of it.In <strong>UML</strong>, a generalization relationship is represented by a large hollow triangle pointing to the ‘generalconcept’ from a ‘specialized concept’. With the notion of generalization and the <strong>UML</strong> modelling notationfor it, the associations between the ¿+ÀÁ[Æ and the payment method can be clearly described by the model inFigure 9.6.9.2.2 The meaning of the generalization-specialization relationshipWhat is the relationship of a supertype to a subtype?A supertype definition is more general or encompassing than a subtype definition.Report No. 259, July 2002<strong>UNU</strong>/<strong>IIST</strong>, P.O. Box 3058, Macau

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

Saved successfully!

Ooh no, something went wrong!