UML / UML 2.0 Diagrams (Part III) 1. Sequence diagram is the most common kind of interaction...

43
UML / UML 2.0 Diagrams (Part III) 1

Transcript of UML / UML 2.0 Diagrams (Part III) 1. Sequence diagram is the most common kind of interaction...

Page 1: 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.

UML / UML 2.0 Diagrams

(Part III)

1

Page 2: 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.

• 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

Page 3: 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.

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

Page 4: 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.

Examples of lifelines

Lifeline "data" of class Stock Anonymous lifeline of class User

Lifeline "x" of class X is selected with selector [k]

4

Page 5: 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.

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

Page 6: 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.

Messages by Action Type

• synchronous call• asynchronous call• asynchronous signal• create• delete• reply

6

Page 7: 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.

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

Page 8: 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.

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

Page 9: 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.

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

Page 10: 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.

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

Page 11: 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.

Delete Message

• sent to terminate another lifeline.

E.g., Online Bookshop terminates Account.

11

Page 12: 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.

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

Page 13: 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.

Messages by Presence of Events

• Complete message• Lost message• Found message• Unknown message

13

Page 14: 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.

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

Page 15: 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.

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

Page 16: 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.

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

Page 17: 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.

Examples of interaction operators

17

Page 18: 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.

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

Page 19: 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.

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

Page 20: 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.

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

Page 21: 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.

Facebook User Authentication

21

Page 22: 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.

22

Currently on Floor 2, still going up

Page 23: 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.
Page 24: 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.

24

Page 25: 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.

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

Page 26: 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.

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

Page 27: 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.

Duration Constraint

Ice should melt into water in 1 to 6 minutes

27

Page 28: 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.

Time Constraint

28

Page 29: 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.

Destruction Event

Virus lifeline is terminated

29

Page 30: 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.

Example Timing diagram

30

Page 31: 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.

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

Page 32: 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.

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

Page 33: 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.

Class Diagram

33

Page 34: 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.

34

Page 35: 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.

35

Page 36: 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.

36

Page 37: 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.

37

CoilDriver State Model

15 times -> “0”8 times -> “1”

Page 38: 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.

38

Communications Manager State Model

Page 39: 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.

39

Processing Statechart

Page 40: 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.

Chamber Model State Model

40

Page 41: 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.

41

Atrial Model State Model

Page 42: 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.

42

Ventricular Model State Model

Page 43: 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.

43