Software Engg Week 9 Activity-Sequence Diagram
Software Engg Week 9 Activity-Sequence Diagram
LECTURE
Activity Diagrams
When to Use:
The main reason to use activity diagrams is to model the
workflow behind the system being designed.
Activity Diagrams are also useful for: analyzing a use case by
describing what actions need to take place and when they
should occur;
Activity diagrams do not give detail about how objects behave
or how objects collaborate.
Activity diagrams -
Notations
Activity Activity states - Represent the performance of a step within
the workflow.
Send Receive
Messages
Objects
Life Line
A sequence diagram is made up of several of these lifeline notations that should be
arranged horizontally across the top of the diagram.
Object
No two lifeline notations should overlap each other.
They represent the different objects or parts that interact with each other in the system
during the sequence.
A lifeline notation with an actor element symbol is used when the particular sequence
diagram is owned by a use case.
Activation
Bars The length of the rectangle indicates the duration of the
objects staying active.
Activation bar is the box In a sequence diagram, an interaction between two objects
placed on the lifeline. occurs when one object sends a message to another.
It is used to indicate that The use of the activation bar on the lifelines of the Message
an object is active (or Caller (the object that sends the message) and the Message
instantiated) during an Receiver (the object that receives the message) indicates that
both are active/is instantiated during the exchange of the
interaction between two message.
objects.
Message
Arrows While you can describe the message being sent from one object to
the other on the arrow, with different arrowheads you can indicate
An arrow from the Message the type of message being sent or received.
Caller to the Message Receiver
specifies a message in a Return Messages
sequence diagram.
A return message is used to indicate that the message receiver is
A message can flow in any done processing the message and is returning control over to the
direction; from left to right, message caller.
right to left or back to the
Message Caller itself. Return messages are optional notation pieces, for an activation bar
that is triggered by a synchronous message always implies a return
The message arrow comes message.
with a description, which is
known as a message
signature, on it.
The format for this message
signature is below.
message_name (arguments):returntype Tip: You can avoid cluttering
up your diagrams by
All parts are optional except the minimizing the use of return
message_name . messages
Reflexive Message Destruction Message
When an object sends a Participants when no longer needed can also be deleted
message to itself, it is from a sequence diagram.
called a reflexive message. This is done by adding an ‘X’ at the end of the lifeline of
It is indicated with a the said participant.
message arrow that starts
and ends at the same
lifeline as shown in the
example below.
How to draw Sequence Diagram
Focus on the use case named ‘Create New User
Account’ to draw our sequence diagram from
given use case diagram.
Before drawing the sequence diagram, it’s
necessary to identify the objects or actors that
would be involved in creating a new user
account. These would be:
• Librarian
• Online Library Management system
• User credentials database
• Email system
Once you identify the objects, it is then important to
write a detailed description on what the use case
does.
From this description, you can easily figure out the
interactions (that should go in the sequence diagram)
that would occur between the objects above, once
the use case is executed.
Steps to create new From each of these steps, you can easily specify what messages should
library User Account be exchanged between the objects in the sequence diagram.
The librarian request the system
to create a new online library
account
The librarian then selects the
library user account type
The librarian enters the user’s
details
The user’s details are checked
using the user Credentials
Database
The new library user account is
created
A summary of the of the new
account’s details are then emailed
to the user
Reference
https://youtu.be/IFqhoJJ3q8A