You are on page 1of 31

Software Engineering

Lecture-17, 18

Maria Hilal, Software Engg-Fall 2022 1


Today’s Agenda

UML Activity Diagram


UML Sequence Diagram

Maria Hilal, Software Engg-Fall 2022 2


Activity Diagram
• Activity diagram is another important diagram
in UML to describe the dynamic aspects of the
system
• Activity diagram is basically a flowchart to
represent the flow from one activity to
another activity.
• The activity can be described as an operation
of the system.

Maria Hilal, Software Engg-Fall 2022 3


Activity Diagram Flow
• The control flow is drawn from one operation
to another.
• This flow can be :
– Sequential
– Branched
– Concurrent
• Activity diagrams deal with all types of flow
control by using different elements such as
fork, join, et

Maria Hilal, Software Engg-Fall 2022 4


Purpose of Activity Diagrams
• The purpose of an activity diagram is:
– To draw the activity flow of a system.
– To describe the sequence from one activity to
another.
– To describe the parallel, branched and concurrent
flow of the system.

Maria Hilal, Software Engg-Fall 2022 5


Where to Use Activity Diagrams?
• Activity diagram can be used for −
– Modeling work flow by using activities.
– Modeling business requirements.
– High level understanding of the system's
functionalities.
– Investigating business requirements at a later
stage

Maria Hilal, Software Engg-Fall 2022 6


How to Draw an Activity Diagram?
• Activity diagrams are mainly used as a
flowchart
• Activity diagrams are not exactly flowcharts as
they have some additional capabilities.
• These additional capabilities include
branching, parallel flow, swimlane, etc

Maria Hilal, Software Engg-Fall 2022 7


How to Draw an Activity Diagram?
• Before drawing an activity diagram, we should
identify the following elements −
– Activities
– Association
– Conditions
– Constraints

Maria Hilal, Software Engg-Fall 2022 8


Activity Diagram of Online Shopping

Maria Hilal, Software Engg-Fall 2022 9


Case:
An automated ticket-issuing system sells rail tickets. Users
select their destination and input a credit card and a
personal identification number. The rail ticket is issued
and their credit card account charged.
When the user presses the start button, a menu display
of potential destinations is activated, along with a
message to the user to select a destination. Once a
destination has been selected, users are requested to
input their credit card. Its validity is checked and the user
is then requested to input a personal identifier. When the
credit transaction has been validated, the ticket is issued.

Maria Hilal, Software Engg-Fall 2022 10


Sequence diagrams
• To model the interactions between the actors and
the objects in a system (or classes in a code).

Maria Hilal, Software Engg-Fall 2022 11


Sequence diagrams contd.
• Shows the sequence of interactions that take place
during a particular use case

Maria Hilal, Software Engg-Fall 2022 12


Sequence diagrams Notations
• The objects and actors involved in a use case are listed along
the top of the diagram, with a dotted line drawn vertically
from these.

Maria Hilal, Software Engg-Fall 2022 13


Sequence diagrams Notations
• Interactions between
objects are indicated by
annotated arrows.
• You read the sequence of
interactions from top to
bottom.
• The annotations on the
arrows indicate the calls to
the objects, their
parameters, and the return
values.

Maria Hilal, Software Engg-Fall 2022 14


Sequence diagrams Notations
• The rectangle on the dotted lines indicates the
lifeline of the object concerned

Maria Hilal, Software Engg-Fall 2022 15


Sequence diagram Example
Interaction at an ATM
• A person goes to the ATM. ATM connects with
the Bank Server to access the Bank Account of
that person.
• Objects: ATM, Bank Server, Bank Account
• Actor: Customer
• Place the actor first on top left.
• Place the objects in sequential order from left to
right.

Maria Hilal, Software Engg-Fall 2022 16


Sequence diagram Example contd.
• Now think of all the steps that happen when
customer goes to get cash from ATM:
1. Insert card

Maria Hilal, Software Engg-Fall 2022 17


Sequence diagram Example contd.
2. ATM checks with the Bank Server to make sure it’s a
valid card.

Maria Hilal, Software Engg-Fall 2022 18


Sequence diagram Example contd.
3. The Bank Server verifies and send the message back
to the ATM. (Return message)

Maria Hilal, Software Engg-Fall 2022 19


Sequence diagram Example contd.
4. The ATM will now ask the Customer to enter PIN.
(Not a return message)

Maria Hilal, Software Engg-Fall 2022 20


Sequence diagram Example contd.
5. If the card is invalid: Alternative frame. A choice
between two or more sequences.

Maria Hilal, Software Engg-Fall 2022 21


Sequence diagram Example contd.
6. If the card was valid and PIN is requested, the user
will input the PIN. (Response message)

Maria Hilal, Software Engg-Fall 2022 22


Sequence diagram Example contd.
7. ATM asks the Bank Server if the PIN is correct.

Maria Hilal, Software Engg-Fall 2022 23


Sequence diagram Example contd.
8. PIN is valid. ATM asks the Customer the amount to
withdraw.

Maria Hilal, Software Engg-Fall 2022 24


Sequence diagram Example contd.
9. If the PIN is invalid, alternative frame is added.

Maria Hilal, Software Engg-Fall 2022 25


Sequence diagram Example contd.
10. The user will input the amount. ATM will start a transaction
with the server. The Bank Server asks the Bank Account if the
funds are sufficient to carry out the transaction.

Maria Hilal, Software Engg-Fall 2022 26


Sequence diagram Example contd.
11. If the funds are sufficient the server will withdraw the
amount and tell the ATM to dispense the cash.

Maria Hilal, Software Engg-Fall 2022 27


Sequence diagram Example contd.
12. If the funds are not successful:

Maria Hilal, Software Engg-Fall 2022 28


Sequence diagram Example contd.
13. In the end, the card is ejected.

Maria Hilal, Software Engg-Fall 2022 29


Sequence
diagram
Example
contd.
• Now add
activation
boxes.

Maria Hilal, Software Engg-Fall 2022 30


References
Chapter-8
Software Engineering, a practitioners approach
by Roger S. Pressman, 7th Edition

Maria Hilal, Software Engg-Fall 2022 31

You might also like