Sequence Diagram
A sequence diagram is a
kind of diagram describing how the
interaction of different object takes
place and in what order.
Sequence diagram is as useful for client as it is useful to a developer to develop the application. It gives the step by step description of a particular operation. Let us take an example of login process . The following event takes place while logging into a website.
Step 1: Client makes a request to server for login page through an interface such as a browser.
Sequence diagram is as useful for client as it is useful to a developer to develop the application. It gives the step by step description of a particular operation. Let us take an example of login process . The following event takes place while logging into a website.
Step 1: Client makes a request to server for login page through an interface such as a browser.
Step 2: Server sends the
login page to browser which is visible to client prompting to provide the login
credentials.
Step 3: Client provides the login information such as username and password.
Step 4: Client side validation takes place for the proper username and password.
Step 5: Browser sends the login credentials to server where again login credentials are validated and then record is searched in database.
Step 3: Client provides the login information such as username and password.
Step 4: Client side validation takes place for the proper username and password.
Step 5: Browser sends the login credentials to server where again login credentials are validated and then record is searched in database.
Step 6: If login
credentials are proper then server responds to browser that authentication is accepted.
Otherwise authentication failed message is forwarded to the browser.
Step 7: if authorization is accepted then home page is displayed, otherwise error page is displayed prompting to provide valid login credentials.
The following sequence diagram illustrates the login process :
The following sequence diagram illustrates the login process :
Now the question arises is how to develop a sequence diagram. I came across the problem of developing sequence diagram while developing SRS for TGMC (The Great Mind Challenge) organized by IBM.
http://www.websequencediagrams.com is a website providing platform to develop interactive sequence diagram. The free version has limited facility but it’s enough for general sequence diagram. All that you need to learn the it’s syntax to develop the diagram. I found it quite easy to use as a lot of illustrations were given on how to develop the diagram. Although you need to google for better experience. I learnt a lot of syntax on this site and a few syntax by googling.
I think this may be useful to you people while developing sequence
diagram for SRS on http://www.websequencediagrams.com.
Basic Syntax
Title: If you want to add a title to diagram then you can use title keyword
followed by your title as illustrated below :
title Sequence Diagram for Login Process
Participant: An object is represented by a participant . Although you don’t need to
specify the participant explicitly but if you need a specific order of objects
then it is mandatory to specify the participant.
for above diagram, we may create participant as follows:
for above diagram, we may create participant as follows:
participant User
participant Interface
participant EHADatabase
# : It is used to provide
a comment.
e.g. # this is a comment
Drawing Simple Signal
e.g. # this is a comment
Drawing Simple Signal
A simple signal from one
object to another object can be drawn as
follows:
#The following line draws a dotted arrow from User to interface
User-->Interface:
Dotted Line
#The following line draws a filled arrow from User to interface
User->Interface: Filled arrow
#The following line draws a Open arrow from User to interface
User->>Interface: Open arrow
#The following line draws a dotted line, open arrow from User to
interface
User-->>Interface: Dotted Line, open arrow
Hence the complete source code looks like this :
User-->Interface: Dotted Line
User-->>Interface: Dotted Line,
open arrow
User->>Interface: Open arrow
User->Interface: Filled arrow
The resulting diagram is
as below:
Signal to Self
A signal to self can be
sent using following syntax:
User->User: This is an illustration of a signal to self
User->User: This is an illustration of a signal to self
Grouping signals
Together
A number of signals can be grouped together using alt/else,opt and loop.
A group needs to be ended explicitly. A group can be followed by a text which
is displayed as heading of the group.
e.g.
e.g.
alt successful case
User->Interface: This is inside a
group
else in case of failure
Output:
Creating Notes
A note can be created left or right to a participant. A note can be made
multiline using ‘\n’ as escape sequence.
e.g.
alt successful case
User->Interface: This is inside a
group
note right of Interface: This is a
note\n right of Interface object
else in case of failure
Output:
Lifeline
Activation, Deactivation and destruction
+ and – is used to activate and
deactivate respectively. + is used to activate receiver and – is used to
deactivate sender. You can explicitly deactivate an object by using deactivate
keyword. An object can be destroyed by using destroy keyword.
e.g.
title Sequence Diagram for
Lodgimg Complaint
participant Patient
participant Interface
participant Admin
participant EHADatabase
Interface->+Patient: Prompt to Enter Text()
Patient->+Interface: Enter Text
note left of Patient: Patient lodges complaint
Interface->+Admin: Forward()
deactivate Admin
Interface->+EHADatabase: Forward()
note right of EHADatabase: Save user complaint in database\n and
generate complaint ID
EHADatabase->+Interface: Generate Complaint ID
Interface->+Patient: Display()
deactivate Patient
destroy Admin
Output:
More details will be provided in future. Leave a comment if you have any
suggestion or query.
No comments :
Post a Comment