Download presentation
Presentation is loading. Please wait.
Published byDerek Nelson Modified over 9 years ago
1
1 Kyung Hee University Interaction Diagrams Spring 2001
2
2 Kyung Hee University Introduction Class diagrams are used to specify the static structure of a system Object diagrams are used to illustrate potential states of the system are typically used only for illustrative purposes To specify an interaction, it must be stated which messages will be sent, in which order, and under which circumstances. collaboration diagrams and sequence diagrams are referred to as interaction diagrams two types of diagram provide alternative ways of expressing the same information
3
3 Kyung Hee University Collaborations Interactions are illustrated by adding messages to an object diagram In order to achieve the required generality, interaction diagram in UML are based on the general notion of a collaboration, rather than on object diagrams. A collaboration is a general description of the ways in which objects can be linked together in order to support the behavior to be supported. Collaborations are related to class diagrams, as both of them specify ways in which objects can be linked together.
4
4 Kyung Hee University Collaborations (cont’d) Collaborations specify only those which are relevant to a particular type of interaction. whereas class diagrams specify all the possible object structures in a system Collaborations are defined not simply in terms of classes, but rather in terms of the roles that instances of those classes can play in various interactions
5
5 Kyung Hee University Classifier Roles Collaborations consists of roles A role describes a particular way in which an object can participate in an interaction. A classifier role describes a role that objects can play in interactions Notation for a classifier role : the name of the role and its base class
6
6 Kyung Hee University Association Roles A collaboration consists of a number of classifier roles connected by association roles It consists of three classifier roles, linked by two association roles for finding the cost of a part in the stock control program
7
7 Kyung Hee University Transient Links An association between two classes implies that instances of the classes can be linked and messages sent between them. Short lived links are known as transient links situations in which objects are able to communicate to distinguish transient links from links that are instances of associations.
8
8 Kyung Hee University Transient Links Parameter ‘part’ is used as the name of the corresponding classifier role, and the association role connecting to the assembly object is labeled with the appropriate stereotype to indicate that this link exists because of the parameter that was passed.
9
9 Kyung Hee University Interaction Diagram Sequence diagram showing classifier roles only, but making the sequencing of messages very clear. Collaboration diagram showing classifier and association roles, and superimposing messages on association roles The major difference between the two forms of diagram is the way they show the order in which message are sent.
10
10 Kyung Hee University Sequence Diagrams The classifier roles involved in the interaction are displayed at the top of the diagram Each role has a dashed line, known as its lifeline Activation : the period of time during which an object is processing a message designated as a narrow rectangle whose top is connected to a message.
11
11 Kyung Hee University Collaboration Diagrams Unlike sequence diagram, collaboration diagrams show association as well as classifier roles messages sequencing cannot be shown graphically
12
12 Kyung Hee University Collaboration Diagrams (cont’d) Hierarchical numbering of messages reflecting explicitly the structure of nested activations
13
13 Kyung Hee University Object Creation The relationship between orders and order lines is one of composition, because we assume that when an order is destroyed all lines of that order are also destroyed.
14
14 Kyung Hee University Object Creation (cont’d) Object creation on a sequence diagram
15
15 Kyung Hee University Object Creation (cont’d) Object creation on a collaboration diagram In order to distinguish elements that are created during the course of an interaction from those which existed at the start, classifier and association roles corresponding to new objects and links are annotated with the property ‘new’.
16
16 Kyung Hee University Object Destruction Messages which cause the destruction of objects are labeled with the stereotype ‘destroy’.
17
17 Kyung Hee University Object Destruction (cont’d) Object deletion on a collaboration diagram
18
18 Kyung Hee University Iterated Messages Showing a collaboration which uses this notation to show that an assembly involved in an interaction can contain zero or more components. Classifier roles and multiplicity
19
19 Kyung Hee University Iterated Messages (cont’d) In order to find out the cost of an assembly, a message must be sent to each of the components, no matter how many there are. To emphasize the fact that a single symbol could correspond to multiple messages, notation is added to message label to indicate an iterated message send. Iterated message passing on a collaboration diagram
20
20 Kyung Hee University Iterated Messages (cont’d) Iteration diagram passing on a collaboration diagram
21
21 Kyung Hee University Multiobjects An alternative way of showing multiplicity information associated with a classifier role is to use a multiobject. a multipoint represents a collection of objects of the base type of the multiobject Showing multiplicity with a multiobject
22
22 Kyung Hee University Multiobjects (cont’d) Showing an order object sending a message to a collection of order lines, asking for the line which corresponds to the catalogue entry with part number ‘n’.
23
23 Kyung Hee University Multiobjects (cont’d) Finding the total cost of an order
24
24 Kyung Hee University Conditional Messages A boolean expression written in square brackets
25
25 Kyung Hee University Conditional Messages (cont’d) Condition messages on collaboration diagrams
26
26 Kyung Hee University Conditional Messages (cont’d) Alternative messages on a sequence diagram
27
27 Kyung Hee University Conditional Messages (cont’d) Messages to Self
28
28 Kyung Hee University Conditional Messages (cont’d) Recursive activations are not shown so explicitly on collaboration diagram but, each recursive activation gives rise to an extra level of hierarchy in the numbering of subsequent messages
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.