0% found this document useful (0 votes)
4 views

l6 7-10-2024 Uml Sequence Diagram

The document explains UML sequence diagrams, which illustrate how objects interact within a system to fulfill specific use cases. It details the components of sequence diagrams, including targets, activation bars, and message types, while also discussing their applications in modeling complex procedures and workflows. Additionally, it emphasizes the importance of use case diagrams in capturing user requirements and how sequence diagrams provide a step-by-step representation of these interactions.

Uploaded by

idk42985
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

l6 7-10-2024 Uml Sequence Diagram

The document explains UML sequence diagrams, which illustrate how objects interact within a system to fulfill specific use cases. It details the components of sequence diagrams, including targets, activation bars, and message types, while also discussing their applications in modeling complex procedures and workflows. Additionally, it emphasizes the importance of use case diagrams in capturing user requirements and how sequence diagrams provide a step-by-step representation of these interactions.

Uploaded by

idk42985
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 38

UML SEQUENCE DIAGRAM

L6 7-10-2024
Progressing from analysis to
design
Information extracted from Use case and
activity diagrams
Use case diagrams provide major user interactions with the system which
identify users’ functional requirements. The analysis of use case diagrams
provide basic information regarding major features of the system under study
and about the major entities which become candidate for persistent classes
and data.

During the requirements analysis phase, activity diagrams assist in capturing


and documenting the dynamic aspects of user interactions.
The activity diagrams focus is on outlining the major activities related with each
use case (feature) irrespective of the actors (entities). The aim of these
diagrams is to details the steps of workflow within a use case to define dynamic
behavior of the whole system. It identifies concurrent and dependent and other
related information including constraints pre and post conditions of the major
activities.
Aim of sequence diagram
•Sequence diagrams add more information
required to understand not only objects ( of major
classes) related to specific use cases described in
the activity diagrams.
•Sequence diagrams analyzes the system in the
form of a group of related objects (of classes)
interacting to perform a specific use case.
•Fro example, objects involved in cash withdraw
use case of ATM system or objects interactions in
flight reservation system.
Applications of Sequence Diagram

•Represents the details of a UML use case.


•Models the logic of a sophisticated procedure,
function, or operation.
•Shows how tasks are moved between objects
or components of a process.
•Helps to plan and understand the detailed
functionality of an existing or future scenario.
UML sequence diagrams
UML sequence diagrams are used to show how
objects interact in a given situation. A sequence
diagram is made up of targets sending messages
to other targets on their lifelines. An important
characteristic of a sequence diagram is that time
passes from top to bottom; the interaction starts
near the top of the diagram and ends at the
bottom
Components of a Sequence Diagram
1.Targets

–Objects/classes
Objects as well as classes can be targets on
a sequence diagram, which means that
messages can be sent to them. A target is
displayed as a rectangle with some text in it.
Objects/lasses
Stereotype of Objects
•Entities/ entity objects
Entities are objects representing system data: Customer,
Product, Transaction, Cart, etc.
•Boundaries/ boundary objects
Boundaries are objects that interface with system actors: User
Interface, Database Gateway,, etc.
•Controls/ control objects
Controls are objects that mediate between boundaries and
entities. They orchestrate the execution of commands coming
from the boundary by interacting with entity and boundary
objects. Controls often correspond to use cases.
Display Icons for Stereotype of Objects
Other notations for Stereotype of Objects
1.

2. 3.
students:Student

Object collection
Activation Bar
The activation bar is the box placed on the lifeline. It is used
to indicate that an object is active (or instantiated) during
an interaction between two objects. The length of the
rectangle indicates the duration of the objects staying
active.
Message Arrows:

An arrow from the Message Caller to the Message Receiver


specifies a message in a sequence diagram. A message can
flow in any direction; from left to right, right to left, or back to
the Message Caller itself. With different arrowheads we can
indicate the type of message being sent or received. The
message arrow also shows a description on it, which is known
as a message signature. The format for this message signature
is below. All parts except the message_name are optional.

attribute = message_name (arguments): return_type


Naming objects - Rules/Conventions
An object should be named only if at least one of the
following applies
You want to refer to it during the interaction as a
message parameter or return value
You don't mention its type
There are other anonymous objects of the same type
and giving them names is the only way to
differentiate them
Avoid long and non-descriptive names (instead of
‘aStudent’ use ‘s’)
Synchronous message
• A synchronous message is used when the
sender must wait until the receiver has finished
processing the message, only then does the
caller continue (i.e. a blocking call). Most
method calls in object-oriented programming
languages are synchronous.
• Represented by a solid line with a solid
arrowhead.
Asynchronous message
With an asynchronous message, the sender
does not wait for the receiver to finish
processing the message, it continues
immediately. Messages sent to a receiver in
another process or calls that start a new
thread are examples of asynchronous
messages. An open arrowhead is used to
indicate that a message is sent
asynchronously.
Asynchronous message
Instantaneous message

Messages are often considered to be


instantaneous, i.e., the time it takes to arrive
at the receiver is negligible. For example, an
in-process method call. Such messages are
drawn as a horizontal arrow.
Non-Instantaneous message
Sometimes however, it takes a considerable amount
of time to reach the receiver. For example, a message
across a network. Such a non-instantaneous message
is drawn as a slanted arrow. (use only when you want
to emphasize the time delay)
Found message

A found message is a message of which the


caller is not shown. Depending on the context,
this could mean that either the sender is not
known, or that it is not important who the
sender was. The arrow of a found message
originates from a filled circle.
Reflexive (self messages)
When an object calls an operation on itself, this is
known as a reflexive message or message to self.
• For example – Consider a scenario where the
device wants to access its webcam. Such a
scenario is represented using a self message.
Constructor Messages

A constructor message creates its receiver.


Targets that exist at the start of an interaction are
placed at the top of the diagram. Any targets that
are created during the interaction are placed
further down the diagram, at their time of creation.
Hence, sender already exists and then creates the
receiver.
Constructor message
Destructor Message
•A destructor message destroys its receiver.
•A target's lifeline extends as long as the target
exists. If the target is destroyed during the
interaction, the lifeline ends at that point in time
with a big cross.
Destructor Message
Creation and destruction
Conditional interaction
Guards

• A message can include a guard, which signifies that the message is only
sent if a certain condition is met. The guard is simply that condition
between brackets.

• In other words, Guards are used when we need to restrict the flow of
messages on the pretext of a condition being met.

• Guards play an important role in letting software developers know the


constraints attached to a system or a particular process.

• For example: In order to be able to withdraw cash, having a balance


greater than zero is a condition that must be met as shown below.
OPT fragment
If you want to show that several messages are
conditionally sent under the same guard, you'll
have to use an 'opt' combined fragment. (shown
as a bigger encompassing rectangle)(equals to if-
construct )
Conditional interaction
Alternative interaction
•If you want to show several alternative
interactions, use an 'alt' combined fragment.

•Equals to nested if-then-else and switch/case


constructs in programming languages.
4. Repeated interaction

When a message is prefixed with an asterisk (the


'*'-symbol), it means that the message is sent
repeatedly. A guard indicates the condition that
determines whether or not the message should
be sent (again). As long as the condition holds,
the message is repeated.
•If you want to show that multiple messages are
sent in the same iteration, a 'loop' combined
fragment can be used.
Example: A sequence diagram for an
emotion based music player
The above sequence diagram depicts the sequence
diagram for an emotion based music player:

•Firstly the application is opened by the user.


•The device then gets access to the web cam.
•The webcam captures the image of the user.
•The device uses algorithms to detect the face and predict
the mood.
•It then requests database for dictionary of possible
moods.
•The mood is retrieved from the database.
•The mood is displayed to the user.
•The music is requested from the database.
•The playlist is generated and finally shown to the user.
Summary

• Use case diagrams show business use cases,


actors, and the relationships between them.
• A sequence diagram can map a scenarios
described by a use case in step by step detail to
define how objects collaborate to achieve your
application's goals.
Example: From Use case to
Sequence Diagram
References
•http://www.tracemodeler.com/articles/a_quick
_introduction_to_uml_sequence_diagrams
/

•https://online.visual-paradigm.com/diagram
s/tutorials
/

You might also like