Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sept 2003 91.3913 Ron McFadyen Interaction Diagrams - Chapter 15 Describe/illustrate sequence of message exchanges among objects that are working together.

Similar presentations


Presentation on theme: "Sept 2003 91.3913 Ron McFadyen Interaction Diagrams - Chapter 15 Describe/illustrate sequence of message exchanges among objects that are working together."— Presentation transcript:

1 Sept 2003 91.3913 Ron McFadyen Interaction Diagrams - Chapter 15 Describe/illustrate sequence of message exchanges among objects that are working together to achieve some functionality required in the system used to illustrate the design required to achieve the purpose Types Communication/Collaboration diagram Sequence diagram

2 Sept 2003 91.3913 Ron McFadyen Sample Collaboration Diagram Suppose an event such as a light turning red occurs, and the traffic light must send a message to the camera letting it know that a red light occurred. PortageMain: trafficLight pm: camera changeToRed() 1:changeToRed() 1.1:takePhoto()

3 Sept 2003 91.3913 Ron McFadyen Sample Sequence Diagram Suppose an event such as a light turning red occurs, and the traffic light must send a message to the camera letting it know that a red light occurred. PortageMain: trafficLightpm: camera changeToRed() takePhoto()

4 Sept 2003 91.3913 Ron McFadyen Interaction Diagrams Messages asynchronous or synchronous components numbered (collaboration diagram) guard name parameter list name is mandatory... others as required

5 Sept 2003 91.3913 Ron McFadyen Messaging Synchronous messages asynchronous messages return messages We will assume (at first) that all messages are synchronous: if object A sends a message to object B then A is suspended object B gains control, and B begins to compute object A waits until B responds (i.e. B sends a message back to A) When an asynchronous message is sent from A to B, A does not pause and wait for B to finish … results in multiple threads of control.

6 Sept 2003 91.3913 Ron McFadyen Collaboration Diagram Timing is understood by the numbering scheme. We use a nested decimal numbering to indicate the order in which messages are sent Many messages may be sent across one link 123543:Student:Student Objects are represented similarly to classes in a class model … relationships are indicated as links between objects named or unnamed 123543:Student:Student 2 nd edition 3 rd edition

7 Sept 2003 91.3913 Ron McFadyen Collaboration diagram for makePayment Messages numbered 1.1, 1.2, … are sent in response to receipt of message numbered 1. Return messages are often left out

8 Sept 2003 91.3913 Ron McFadyen Message to ‘this’ or an object itself A message sent from an object to itself (i.e. invoking one of its own methods) is indicated by a reflexive link, but this does not imply a reflexive association

9 Sept 2003 91.3913 Ron McFadyen Instance creation We will use a create message to indicate that an object is being instantiated

10 Sept 2003 91.3913 Ron McFadyen Sequence Numbering The initial message triggering the collaboration is unnumbered. All messages sent as the result of an object receiving a message numbered X, are prefixed with “X.” Note: pay special attention to the numbering

11 Sept 2003 91.3913 Ron McFadyen Complex numbering We need a numbering scheme to know the order of messages

12 Sept 2003 91.3913 Ron McFadyen Conditional Message A guard (enclosed in square braces [ ] ) indicates a condition that must be true for the message to be sent

13 Sept 2003 91.3913 Ron McFadyen Mutually exclusive messages a, b, etc are used as suffixes to indicate mutually exclusive messages. A guard would also be used

14 Sept 2003 91.3913 Ron McFadyen Iteration Numbered 1 Iteration indicator * Guard [i:=1..N]

15 Sept 2003 91.3913 Ron McFadyen Iteration over a multiobject A multi-object represents a collection of objects. E.g. the SalesLineItems for a Sale; E.g. the ProductSpecifications for a ProductCatalog 2 nd edition

16 Sept 2003 91.3913 Ron McFadyen Iteration over a collection On the right hand side is one object/instance from the collection E.g. the SalesLineItems for a Sale; E.g. the ProductSpecifications for a ProductCatalog 3 rd edition :Sale lineItems[i]: SalesLineItem t = getTotal 1 * [i=1..n]: st = getSubtotal

17 Sept 2003 91.3913 Ron McFadyen Messages to a class itself, not an object A message may be sent to the class, and not to a specific object. 2 nd edition

18 Sept 2003 91.3913 Ron McFadyen Messages to a class itself, not an object A message may be sent to the class, and not to a specific object. 3 rd edition discusses messages sent to a > … in Java, classes are considered instances of class Class… Class is considered a metaclass :Foo > Calendar doX getAvailableLocales 3rd edition


Download ppt "Sept 2003 91.3913 Ron McFadyen Interaction Diagrams - Chapter 15 Describe/illustrate sequence of message exchanges among objects that are working together."

Similar presentations


Ads by Google