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.

Creating Collaboration Diagrams 113Remarks about messages to multiobjectsNotice that in general, a message, such asÔrÅ ÑandÀÑ¥Ñ, sent to a multiobject is to the collection object itself,not to every object in the collection. The message êÊ[ê‡ç¼Ò Ï Æ:À§ÈXÆÖ¤× sent to the ¿+ÀÁ[ÆWÂ:à ÄLÅ+Æ9ÇWÈXÆÉ multiobject isfor the creation of the collection data structure represented by the multiobject, it is not the creation of aninstance of class ¿+À§Á†ÆDÂ;à ÄLÅ+ÆSÇWÈXÆDÉ . The À Ñ¥Ñmessage (3.2) sent to the ¿+ÀÁ[ÆWÂ:à ÄLÅ+Æ9ÇWÈXÆÉ multiobject is to addelement to the collection data structure represented by the multiobject.Collaboration Diagram ÆDÅ Ñ ¿+ÀÁ[Æ forThe first design decision is to choose a controller to handle this system operation. We continue toΗÙuseas the controller for this operation.¿]ÚThe contract of ÆDÅ Ñ ¿-ÀÁ†ÆÖ¤× requires¾ ¿-ÀÁ†ÆʆÄ^ÂÛ Ð É’Ó_Á[ÆÈXÆ was set to È Ï ÌsÆ (attribute modification).By Expert, it should be the ¿+ÀÁ[Æ itself to carry out this responsibility, since it owns and maintains theÄ^ÂÛ Ð É’Ó_Á[ÆÈXÆ attribute. Thus the Η٠¿ Ú will send a message, denoted by ÕSÆ9Ò Ð ÉdÆ¥Û Ð É¨Ó+Á†ÆÈXÆ , to the ¿-ÀÁ†Æ inorder to set it to È Ï ÌsÆ . This assignment of responsibility is shown in Figure 7.31.endSale():POST1:becomeComplet():SalebecomeComplete(){isComplete:=true}Figure 7.31: Completion of item entryCalculating ¿+ÀÁ[Æ the total Although we are not at the moment concerned ourselves <strong>with</strong> how the saletotal will be displayed, we must ensure that all information that must be displayed is known and availablefrom the domain objects. Note that no class current knows the sale total, so we need to create a design ofthe object interactions, using a collaboration diagram, to calculate the sale total.In Section 7.4.1, we used the assignment of the responsibility for knowing and returning the total of sale tounderstand the use of the Expert Pattern. There we obtained the collaboration diagram illustrated in Figure7.19. In Figure 7.32, we only add some pseudo-codes to clarify the purposes of some of the operations.In general, since arithmetic is not usually illustrated via messages, the details of the calculations can beshown by attaching constraints to the diagram that defines the calculations.We have one question unanswered: who will send the È Ð È`ÀÁ message to the ¿+ÀÁ[Æ ? Most likely it will be anobject in the interface, such as a Java applet.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!