Download presentation
Presentation is loading. Please wait.
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 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 Objects are represented similarly to classes in a class model … relationships are indicated clearly Objects may be named or unnamed 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
7
Sept 2003 91.3913 Ron McFadyen Figure 15.3 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 Figure 15.7 Messages Many messages may be sent across one link Messages numbered 1, 2, 3 are sent in response to receipt of message msg1; message 3.1 is sent in response to message 3
9
Sept 2003 91.3913 Ron McFadyen Figure 15.8 Message to ‘this’ 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
10
Sept 2003 91.3913 Ron McFadyen Figure 15.9 Instance creation We will use a create message to indicate that an object is being instantiated
11
Sept 2003 91.3913 Ron McFadyen Figure 15.10 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.”
12
Sept 2003 91.3913 Ron McFadyen Figure 15.11 Complex numbering We need a numbering scheme to know the order of messages
13
Sept 2003 91.3913 Ron McFadyen Figure 15.12 Conditional Message A guard (enclosed in square braces []) indicates a condition that must be true for the message to be sent
14
Sept 2003 91.3913 Ron McFadyen Figure 15.13 Mutually exclusive messages a, b, etc are used as suffixes to indicate mutually exclusive messages. A guard would accompany these
15
Sept 2003 91.3913 Ron McFadyen Figure 15.14 Iteration
16
Sept 2003 91.3913 Ron McFadyen Figure 15.15 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
17
Sept 2003 91.3913 Ron McFadyen Figure 15.16 Messages to a class itself, not an object A message may be sent to the class, and not to a specific object.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.