7
Session Sequence Diagram Checklist Introduction to Sequence diagram Explain Sequence Diagram

Sequence Diagram

Embed Size (px)

Citation preview

Page 1: Sequence Diagram

1

Session

Sequence Diagram

Checklist

Introduction to Sequence diagram

Explain Sequence Diagram

Page 2: Sequence Diagram

2

Sequence Diagram

Sequence diagram helps to model the interaction between objects. Sequence diagram is one of

the most used UML diagrams next to class diagrams. Sequence diagrams are very useful for

validation and software design. It helps to get a better understanding of the flow of your

system and in reverse engineering if the system is complex. Sequence diagram can be applied

to a single scenario or a specific part of a use case. One added advantage is, there are no

difficult syntax in sequence diagrams, and they have been already covered in the previous

sessions.

Let us learn sequence diagram using a simple scenario. Our system has many functionalities in

which validating user’s PIN (Personal Identification Number) is one of them. I am going to

model the following use case.

I. User enters his PIN number to the system

II. Our system is going to validate the PIN number with the database

III. If the user has entered his PIN number correctly, our system will give “SUCCESS”

acknowledgement

IV. If the user has entered PIN number wrongly, our system will give “FAILURE” notification

to the user

V. Our system allows 3 chances for the user to enter the PIN number.

VI. In the end of the process, our system displays advertisement banner which is optional

and users can ignore them.

So our sequence diagram for “PIN Verification” looks like the figure below

Page 3: Sequence Diagram

3

Figure 1: PIN Verification Sequence Diagram

Page 4: Sequence Diagram

4

Elements of a Sequence Diagram

Lifeline

Figure 2: Object Lifeline

: Objects who are participants in the use case

are represented as lifeline. Scope of the object

will be for the entire scenario. Format for an

object lifeline is shown in the figure

Object Notation

Anonymous Object

Stereotype

Figure 3: Stereotypes

: Users can add stereotypes to objects to assign

special meaning to an object. Sometimes they

may be specific to a system. Adding

stereotypes is optional.

Create object

Figure 4: Create Object Notation

:

When an object creates another object in a

system, it could be modeled using the notation

illustrated in the figure.

Class name: Object Name

: Object Name

Page 5: Sequence Diagram

5

Destroy object

Figure 5: Destroy Object Notation

:

When an object is destroyed during runtime, it

is denoted by placing a (X) mark in the object

lifeline. Notation for destroy object is

illustrated in the figure.

Interaction Frames

A common issue with sequence diagram is how to show looping or conditional behavior. First

thing is that activity diagrams are your best bet for showing conditional behavior. Second thing

is that conditional behavior is possible in sequence diagram using interaction frames.

You can see the usage of interaction frames in our example “PIN Verification”.

Figure 6: Interaction Frame Notation

Page 6: Sequence Diagram

6

Message Format

Figure 7: Message Types

: Core of sequence diagram is the message flow

between objects. Messages are indicated

using labeled arrows with a brief text

describing the information being

communicated.

There are two types of messages –

Synchronous and Asynchronous

Synchronous messages are denoted by a filled

arrow head and asynchronous messages are

denoted by a normal arrowhead.

Active Region

Figure 8: Active Region Notation

:

Activation Region in a sequence diagram indicates how long the object is active in the interaction. If you see in the figure to the left, Object2 remains active when it is receives message from Object 1 and returns the result to Object 1. But Object 1 is sending messages to other Objects which makes its activation region to be extended.

Page 7: Sequence Diagram

7

Review

Sequence diagram is used to model interaction between objects during

Runtime

They are useful to understand the system flow, software design and

Validation

Sequence diagrams is the most used UML diagram next to class diagram