UML / UML 2.0 Diagrams (Part III) 1. Sequence diagram is the most common kind of interaction...
-
Upload
loreen-miles -
Category
Documents
-
view
218 -
download
2
Transcript of UML / UML 2.0 Diagrams (Part III) 1. Sequence diagram is the most common kind of interaction...
UML / UML 2.0 Diagrams
(Part III)
1
• Sequence diagram is the most common kind of interaction diagram.
• It focuses on the message interchange between a number of lifelines.
• An UML sequence diagram is typically composed of – lifeline, execution specification, message,
combined fragment, interaction use, state invariant, continuation, destruction event.
UML Sequence Diagrams
2
Lifeline
• Lifeline is a named element which represents an individual participant in the interaction.
• While parts and structural features may have multiplicity greater than 1, lifelines represent only one interacting entity.
3
Examples of lifelines
Lifeline "data" of class Stock Anonymous lifeline of class User
Lifeline "x" of class X is selected with selector [k]
4
Message• Message is a named element that defines one
specific kind of communication between lifelines of an interaction.
• A message is shown as a line from the sender message end to the receiver message end.
• The line must be such that every line fragment is either horizontal or downwards when traversed from send event to receive event.
• A message reflects either an operation call and start of execution or a sending and reception of a signal.
5
Messages by Action Type
• synchronous call• asynchronous call• asynchronous signal• create• delete• reply
6
Synchronous Call
• A type of operation call - send message and suspend execution while waiting for response.
Web Client searches Online Bookshop and waits for results.
7
Asynchronous Call
• A type of operation call - send message and proceed immediately without waiting for return value.
Service starts Task and proceeds in parallel without waiting.
8
Asynchronous Signal
• corresponds to asynchronous send signal action E.g. Notify Customer
send signal actioncreates and sends Notify Customer signal
E.g. After order is shipped, Notify Customer send signal actioncreates and sends Notify Customer signal 9
Create Message
• Create message is sent to lifeline to create itself. In real life, create message is sent to some runtime environment.
E.g. Online Bookshop creates Account.
10
Delete Message
• sent to terminate another lifeline.
E.g., Online Bookshop terminates Account.
11
Reply Message
• to an operation call is shown as a dashed line with open arrow head
E.g. Web Client searches Online Bookshop and waits for results to be returned.
12
Messages by Presence of Events
• Complete message• Lost message• Found message• Unknown message
13
Lost Message
• Where the sending event is known, but there is no receiving event.
• Interpreted as if the message never reached its destination
E.g. Web Client sent search message which was lost.
14
Found Message
• Where the receiving event is known, but there is no (known) sending event.
• Interpreted as if the origin of the message is outside the scope of the description.
E.g. Online Bookshop gets search message of unknown origin.
15
Combined Fragment
• An interaction fragment which defines a combination (expression) of interaction fragments.
• Defined by an interaction operator and corresponding interaction operands.
• Through the use of combined fragments the user will be able to describe a number of traces in a compact and concise manner.
16
Examples of interaction operators
17
Strict sequencing vs. weak sequencing
Strict Sequencing: Search Google, Bing and Yahoo in the strict sequential order.
Weak Sequencing: Search Google possibly parallel with Bing and Yahoo, but search Bing before Yahoo.
18
Examples of interaction operators (cont.)
The interaction operator critical defines that the combined fragment represents a critical region. A critical region is a region with traces that cannot be interleaved by other occurrence specifications (on the lifelines covered by the region).
19
Interaction Use
• An interaction fragment which allows to use (or call) another interaction.
• Large and complex sequence diagrams could be simplified with interaction uses.
• It is also common reusing some interaction between several other interactions.
Use Login interaction to authenticate user and assign result back to the user attribute of Site Controller.
Interaction name
I/o arguments Return-value
Interaction use
20
Facebook User Authentication
21
22
Currently on Floor 2, still going up
24
Timing Diagrams
• Show interactions when a primary purpose of the diagram is to reason about time.
• Focus on conditions changing within and among lifelines along a linear time axis.
• Describe behavior of both individual classifiers and interactions of classifiers, focusing attention on time of events causing changes in the modeled conditions of the lifelines.
25
State or Condition Timeline
• show states of the participating classifier or attribute, or some testable conditions, such as a discrete or enumerable value of an attribute.
Timeline shows Virus changing its state between Dormant, Propagation, Triggering and Execution state
26
Duration Constraint
Ice should melt into water in 1 to 6 minutes
27
Time Constraint
28
Destruction Event
Virus lifeline is terminated
29
Example Timing diagram
30
Discussions
• Actions: the elemental quanta of UML behavior. (see slide 9)
• Events: Signal / Call / Time / Change events (resulting in state transition)
• Messages: generated by action or event• Calls: One type of actions/messages• Signals: One type of actions/messages
31
Put Them All Together
• Cardiac Pacemaker• Three Letter parameters
– First Letter (A, V, or D) whether the atrium or the ventricle or both is being paced
– Second Letter (A, V, or D) whether the atrium or the ventricle or both is being monitored
– Third Letter (I, T, or D) indicating if inhibited, triggered or dual pacing modes
32
Class Diagram
33
34
35
36
37
CoilDriver State Model
15 times -> “0”8 times -> “1”
38
Communications Manager State Model
39
Processing Statechart
Chamber Model State Model
40
41
Atrial Model State Model
42
Ventricular Model State Model
43