0% found this document useful (0 votes)
25 views31 pages

L5 30-9-2024 Activity Diagram

The document provides an overview of UML activity diagrams, which illustrate the dynamics and workflow of a system through flow charts. It explains the structure of activity diagrams, including core symbols, decision activities, and the use of swimlanes to represent responsibilities. Additionally, it outlines when to use activity diagrams, their limitations, and a step-by-step guide for creating them.

Uploaded by

idk42985
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views31 pages

L5 30-9-2024 Activity Diagram

The document provides an overview of UML activity diagrams, which illustrate the dynamics and workflow of a system through flow charts. It explains the structure of activity diagrams, including core symbols, decision activities, and the use of swimlanes to represent responsibilities. Additionally, it outlines when to use activity diagrams, their limitations, and a step-by-step guide for creating them.

Uploaded by

idk42985
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

UML Activity diagram

Object Oriented Analysis and Design

L5 30-9-2024
UML Diagram Hierarchy
• 14 UML diagrams
• Divided into two categories
• Structure diagrams show the things in a
system being modeled, that is, they show
different objects in a system.
• Behavioral diagrams shows what should
happen in a system. They describe how the
objects interact with each other to create a
functioning system.
What we have already seen?
• Class diagram and object diagram
(Structure diagrams)
• Use case diagram (behavior diagram)
Activity Diagrams
Definition
• Activity diagrams represent the dynamics (or
workflow) of the system in a graphical way.
• They are flow charts.
• They show.
– The flow of control from activity to activity in the
system, and
– What activities can be done in parallel, and
– Alternate paths through the flow.
• They can show the flow across use cases or within
a use case.
Activity Diagram
• Core symbol is an activity.
• An activity is some task which needs to be
done.
• Each activity can be followed by another
activity (sequencing).
• Triggers from the activity may be guarded
as in state diagrams.
Decision Activities
• Diamond.
• Each trigger coming from it has a guard. (Y / N)
• Synchronisation bar.
or

• All triggers from this attach to activities that can occur


in parallel, with no specific sequence, or concurrently.
• The next synchronisation bar closes the concurrency.
• Iteration is represented by a * on the trigger.
Activity Diagrams for Use Cases
• They can be used for describing either
– Use cases or
– Complicated methods
Example [no coffee] [no coke]
Find
drink
[found coffee]

Put
Add water Get
coffee
to reservoir cups Get can
in filter
Put filter of coke
in
machine

Turn on
machine

make
coffee

Pour Drink
coffee
Combining Use Cases
• The end point of an activity diagram is the
point at which all triggered activites have
been run and there are no more left to do.
• Dead ends (e.g. Reorder item) can occur.
• Sometimes dead ends meet up with other
use cases (e.g. Check line item).
Drawback
• Activity diagrams tell you what is
happening, but not who does what.
• In domain modelling, this diagram type
does not convey which people or
departments are responsible for each
activity.
• In programming, it does not convey which
class is responsible for each activity.
Swimlanes
• Arrange activity diagrams into vertical
zones separated by dashed lines.
• Each zone represents the responsibilities of
a particular class or department.
When to Use Activity Diagrams
• Do use them for
– Analysing Use Cases.
– Understanding workflow across many Use
Cases.
– Dealing with multi-threaded applications.
• Don’t use them
– to see how objects collaborate.
– to see how an object behaves over its lifetime.
Receive
order
Activity
* for each line Diagram for
Receiving an
Authori item on order
Check
se line
[failed]
Paymen item[in stock]
Cancel
t
Assign
Order
Order [succeeded]
to
Order

[need to Reorder
reorder] item
[stock assigned
to all line items
and payment
authorised]
Dispatc
h
Order
Activity Receive
Diagram Supply

for
receiving Choose
outstanding
Supply order items
* for each chosen
order item
Assign
goods
to order
[all outstanding
order items filled]

Add
Dispatc remainder
h to stock
Order
Combined
Receive
Activity
order
Diagram Receive
Supply
* for each line
item on order Choose
Authori Check
se line outstanding
Paymen item[in stock] order items
t
[failed] * for each chosen
[succeeded] Assign order item
Assign
to
Cancel goods
Order
Order to order
[need to Reorder
reorder] item
[stock assigned
to all line items [all outstanding
and payment order items filled]
authorised] Dispatc Add
h
remainder
Order
to stock
Financ Order Stock
e Processin Manage
Receive g r
order
Receive
Supply
* for each line
item on order Choose
Authori Check
se line outstanding
Paymen item[in stock] order items
t
[failed] * for each chosen
[succeeded] Assign order item
Assign
to
Cancel goods
Order
Order to order
[need to Reorder
reorder] item
[all outstanding
[stock assigned order items filled]
to all line items Dispatc
Add
and payment h
remainder
authorised] Order
With Swimlanes to stock
Understanding Workflows
– Each activity represents the performance of
a group of actions in a workflow.
– Once the activity is complete, the flow of
control moves to the next activity or state
through a transition.
Understanding Workflows
– A unique activity diagram feature is a
swimlane that defines who or what is
responsible for carrying out the activity
or state.
– It is also possible to place objects on
activity diagrams.
– The workflow stops when a transition
reaches an end state.
Activity Diagram Tools
• You can use the following tools on the activity
diagram toolbox to model activity diagrams:
– Activities
– Decisions
– Object
– Object Flow
– States
• Start State
• End State
– Swimlanes
– Synchronizations
– Transitions
Placing an Activity diagram
• Where?
– You can attach activity diagrams to most model
elements in the use case or logical views.
– Activity diagrams cannot reside within the
component view.
• Why?
– Very effective in illustrating the workflow of
various events in a use-case diagram.
– You can use activity diagrams to specify and
define each event in a use-case diagram.
Creating an activity diagram
• Modelling a workflow in an activity diagram
1. Identify a workflow objective.
2. Decide the pre and post-conditions of the
workflow.
3. Define all activities and states.
4. Define any objects that are created or modified.
5. Decide on responsibility for performing the
activities.
6. Connect all elements on the diagram with
transitions.
7. Place decisions on the diagram.
8. Evaluate your diagram for concurrent workflows.
9. Set all actions, triggers and guard conditions in
the specifications of each model element.
1. Identify a workflow objective.
– "What needs to take place or happen by the end
of the workflow? What needs to be
accomplished?“
– For example, if your activity diagram models
the workflow of ordering a book from an online
bookstore, the goal of the entire workflow
could be getting the book to the customer.

– (Q. what is the goal of ATM withdraw


activity?)
2. Workflow pre and post-
conditions
– Define pre and post conditions of the workflow
through a start state and an end state.
– In most cases, activity diagrams have a flowchart
structure so start and end states are used to
designate the beginning and ending of the
workflow.
– Start and end states clarify the perimeter of the
workflow.
– What is the pre-condition of the Withdraw cash
workflow in ATM system?
Define activities and states
• Define and recognize all activities and
states that must take place to meet your
objective. Place and name them on the
activity diagram in a logical order.

Identify persistent object
operations
• Define and diagram any objects that are
created or modified within your activity
diagram.
• Connect the objects and activities with
object flows.
Add swimlanes
• Decide who or what is responsible for performing
the activities and states through swimlanes.
• Name each swimlane and place the appropriate
activities and states within each swimlane.
• Identify swimlanes for ATM
Finish diagram
• Connect all elements on the diagram with
transitions.
• Place decisions on the diagram where the
workflow may split into an alternate flow.
– E.g. based on a Boolean expression, the workflow
could branch to a different workflow.
• Evaluate your diagram and see if you have any
concurrent workflows. If so, use synchronizations
to represent forking and joining.
• Set all actions, triggers and guard conditions in the
specifications of each model element.
Practice
• Create an activity diagram for online
shopping scenario.
• Design scenario for a software development
problem ,

• For example, Car parking management


system, Hotel management system

You might also like