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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

124 QuestionsStore1address:Addressname:TextaddSale()1Houses1UsesLooks-in11ProductCatalogspecification()loadProdSpecs()Contains1 1..*ProductSpecificationdescription:Textprice:Quantityupc:UPC1Describes*11SaleSalesLineItemPOSTdate:datetime:TimeisComplete:BooleanContains1 1..*quantity:Integersubtotal()endSale()enterItem()makePaymentbecomeComplete()makeLineItem()makePayment()total()*1PaymentLogs-completedPaid-by1amount:QuantityFigure 7.42: Design diagram <strong>with</strong> association and navigabilityWe do not show the messageÒÏ Æ9À§ÈXÆÖ¤× sent to a class as a method of the class, because its interpretation¾is dependent on programming languages.¾Accessing methods are those which retrieve (accessor method) or set (mutator methods) attributes. Itis a common idiom to have an accessor and mutator for each attribute, and to declare all attributesprivate (to enforce encapsulation). These methods are also usually excluded from the class diagrambecause of the high noise-to-value ratio they generate.7.4 Questions1. What is the difference between *msg(), *[true] msg(), and [true] msg() in a collaboration diagram?2. You might think it would be more obvious just to number all the messages in a collaboration diagramusing êå9ð©åÊÊÊBå rather than using the nested scheme. What diference would it make? Can youconstruct a situation in which it would be ambiguous?3. We have said that the <strong>UML</strong> creation message is denoted by Ò Ï Æ:À§ÈXÆÖ¤× (sometimes <strong>with</strong> parameters)<strong>with</strong> the newly created object labelled <strong>with</strong> Þ›ÞñÅ+Æòàâ›â . In a collaboration diagram, objects mybe deleted/destroyed as wel as created. The <strong>UML</strong> notation for a message destroying an object isÑ ÆWÂWÈ Ï;Ð Í+Ö¤× <strong>with</strong> the deleted objects labelled <strong>with</strong> ÞÞ Ñ ÆWÂDÈ Ï¦Ð Í¥Æ Ñ ââ .Can you think of a situation when we need to show in a collaboration diagram an object beingdestroyed?4. Develop a collaboration diagram in which: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!