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 a new ¿-ÀÁ†ÆDÂ;Ã]Ä^Å+ÆSÇWÈXÆDÉThe other post-conditions in the forÆDÅ_ÈXÆ Ï ÇWÈXÆDÉ contract indicate the responsibility to a¿+ÀÁ[ÆWÂ:à ÄLÅ+Æ9ÇWÈXÆÉcreateinstance. From the conceptual model creator,¿+ÀÁ[Æ and is an appropriate candidate creator the¿+ÀÁ[ÆWÂ:à ÄLÅ+Æ9ÇWÈXÆÉforCreating Collaboration Diagrams 111enterItem(upc,qty):POST1:[new sale] create():Sale1.1:create():SalesLineItemFigure 7.29: Sale creationobject. And by the¿-ÀÁ†Æ having ¿+ÀÁ[ÆWÂ:à ÄLÅ+Æ9ÇWÈXÆÉ create , ¿+ÀÁ[Æ the can be associated <strong>with</strong> ¿+ÀÁ[ÆWÂ;Ã]Ä^Å-Æ9ÇWÈXÆDÉtheobject over time by storing new instance in its collection of line items. The post conditions also indicatethat the ¿+ÀÁ[ÆWÂ:à ÄLÅ+Æ9ÇWÈXÆÉ new objects needs a quantity when it is created. Therefore, the ¿ Ú mustpass the quantity along to ¿+ÀÁ[Æ , which must pass it along as a parameter in the creation message to theΛ٠ÄLÅ+Æ9ÇWÈXÆÉ . ¿+ÀÁ[ÆWÂ:ÃFinding a ΥϦÐÑ Ì•ÒÈL¿§Ó•Æ9ÒÈTÄÔQÒ9À§ÈTÄ Ð Å The postcondition in the contract of ÆÅsÈXÆ Ï ÇWÈXÆDÉ also requires the newlycreated ¿+ÀÁ[ÆWÂ:à ÄLÅ+Æ9ÇWÈXÆÉ to be associated <strong>with</strong> the ÎFÏ;ÐÑ ÌJÒÈL¿¥Ó•Æ:ÒÄÔQÒSÀ§ÈTÄ Ð Å that matches the Ì©Ó…Ò of the item.This implies that the parameters to theÉtÀاÆ9Ã]Ä^Å-Æ9ÇWÈXÆDÉ message sent to the¿+À§Á†Æ include the ΥϦÐÑ Ì•ÒÈL¿§Ó•Æ9ÒÄÔQÒ9À§ÈTÄ Ð Åinstance, denoted byÂXÓ•Æ:Ò , which matches theÌ©Ó…Ò . This then requires to retrieve this ΥϦÐÑ ÌJÒÈL¿§Ó•Æ9ÒÈTÄÔQÒ9À¥ÈTÄ Ð Åobjects before the message ɈÀBاÆSÇWÈXÆDɉ֤ÂXÓ•Æ:Ò¥åËÈTÍJ× is sent to the ¿+ÀÁ[Æ . From the conceptual model andthe Expert pattern, ÎFÏ;ÐÑ ÌJÒÈ:Û]À§È`À©Ã Ð:ælogically contains all the ΥϦÐÑ Ì•ÒÈL¿§Ó•Æ9ÒÄÔQÒ9À§ÈTÄ Ð Å•Â . Thus by Expert,ÎFÏ;ÐÑ ÌJÒÈ:Û]À§È`Àà Ð9æis a good candidate for looking up the ÎFÏ;ÐÑ ÌJÒÈL¿§ÓJÆ:ÒÄÔQÒSÀ§ÈTÄ Ð Å .Visibility to a ProductCatalogAfter we have assigned the responsibility to ÎFÏ;ÐÑ ÌJÒÈ:Û]À§È`À©Ã Ð:æfor looking up the ΥϦÐÑ ÌJÒÈL¿§Ó•Æ9ÒÄÔQÒ9À¥ÈTÄ Ð Å , wesould also decide the object that should send the message to the ΥϦÐÑ ÌJÒÈ:Û]À§È`ÀÁÐ:æto ask for a ÎFÏ;ÐÑ ÌJÒÈL¿¥Ó•Æ:ÒÄÔQÒSÀ§ÈTÄ Ð Å .In order for one object ç…è to send a message to another object çé , object ç…è must be currently linked toobject çé . In OOD, the linkage between two objects is closely related to the concept of visibility of anobject. The difference and relationship between the concepts of association and visibility are:If çè has visibility to çé , there must be a link between çè and çé , and thus there must be an¾association classè between classé and .If there is current a link ç©è and çé , then one of the two objects has visibility to the other, though it¾is not necessarily they have visibility to each other.We should now restate more precisely about the message passing between objects asReport 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!