Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
UML2
UML2
Interaction Diagrams
models that describe how groups of objects interact (collaborate) class and use case diagrams are useful at capturing the structural nature of a system design in a generalized way interaction diagrams capture dynamic behavior applicable to timing or sequencing requirements
UML2 Wolfgang Pelz 2000-04
3
UML2
Sequence
boxes at the top are participants (objects); vertical lines are time lines; horizontal directed lines are messages; unless specifically noted, only sequence (location on the time line) is important, not exact times an activation rectangle in the lifeline indicates a focus of control (activation) during which an object is performing an action, either directly or through another object
UML2 Wolfgang Pelz 2000-04
5
Notation (UML 1)
UML2
UML2
Some Elaborations
Usually objects have concurrent life spans so they are aligned at the diagrams top. If an object is created, its lifeline starts with the receipt of a << create >> message. Destruction can be explicitly noted with X. Sequence diagrams are good at visualization of how objects interact, but not good at showing details of algorithms, such as loops.
UML2
UML2
UML2
10
and Another
UML2
11
UML2
12
Time Constraints
UML2
13
UML2
14
Notations (UML 2)
A participant was just an object in UML 1, but can be more than that (e.g. a group of objects) in UML 2. No more underline below the name in UML 2. : needs to be there with the class name in UML 2.
aParticipant:Class
aParticipant
:Class
UML2
15
Interaction Frames
New in UML2 Notations for loops, conditions and other detail algorithms. Common operators for Interactive Frames: alt (alternative), opt (optional), par (parallel), loop (loop), region (critical region), neg (negative), ref (reference), sd (sequence diagram).
UML2 Wolfgang Pelz 2000-04
16
UML2
17
UML2
18
UML2
19
UML2
20
Which to Use?
Choose sequence diagram when only the sequence of events needs to be shown and collaboration among the objects are priority. Choose a collaboration/communication diagram when the objects and their links facilitate understanding the interactions (you dont have to put all objects at the top and make the lines all vertical or horizontal). Collaboration diagrams have relatively fixed notation and numbering scheme.
UML2 Wolfgang Pelz 2000-04
21
UML2
22
UML2
23
UML2
24
Message Sequencing
UML2
25
UML2
26
UML2
27
Sequence Diagram
UML2
28
UML2
29
UML2
30
Exercise
Draw the sequence diagram corresponding to the previous collaboration diagram
UML2
31
Other Notations
{tagged value} - in a class - a property either predefined or defined by the user to hold additional information about elements {constraint} - outside a class - applied to the role of the link active object - executes concurrently with its own thread of control
UML2 Wolfgang Pelz 2000-04
33