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.

110 Creating Collaboration DiagramsenterItem():POST1: ????()endSale():POST1: ????()makePayment():POST1: ????()startUp():POST1: ????()POSTenterItem()endSale()makePayment()startUp()Figure 7.28: System operationsAfter assigning the responsibility for handling ÆDÅ_ÈXÆ Ï ÇWÈXÆDÉ to Λ٠¿ Ú , we need to look at the contract ofÆDÅ_ÈXÆ Ï ÇWÈXÆDÉ what Η٠¿ Ú needs to do to fulfill this responsibility.Displaying item description and priceIn general, model objects are not responsible for display of information. These are the responsibilities ofinterface objects which can access to data known by model objects and can send messages to model objects.However, model objects do not send messages to interface objects in order to keep the system independentof the interface.Creating a new ¿-ÀÁ†ÆThe post-conditions of ÆDÅsÈXÆ Ï ÇWÈXÆÉ indicate a responsibility for creation an object ¿+ÀÁ[Æ . The Creator patternsuggests Λ٠¿ Ú is a reasonable candidate creator of the ¿+ÀÁ[Æ , as Η٠¿]Ú records the ¿-ÀÁ†Æ . Also by havingΗ٠¿]Ú create the ¿+À§Á†Æ , the Η٠¿ Ú can easily be associated <strong>with</strong> it over time.In addition to the above, when the¿+À§Á†Æ is created, it must create an empty collection to record all the future¿+ÀÁ[Æ9Ã]Ä^Å-Æ9ÇWÈXÆDÉ that will be added. This collection will be maintained by the ¿+ÀÁ[Æ instance, which impliesby Creator that the ¿-ÀÁ†Æ is a good candidate for creating it.Therefore, we have the collaboration diagram shown in Figure 7.29.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!