Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

Activity Diagrams

Chapter 6

Object-Oriented Software Systems Engineering – Chapter 6 Slide 1


Objectives

In this chapter we will:


 Introduce Activity Diagrams
 Discuss where activity diagrams are used

Object-Oriented Software Systems Engineering – Chapter 6 Slide 2


Activity Diagrams

 Use activity diagrams in the context of


 system as whole
 a subsystem
 an operation

 Model dynamic aspect of a system in two ways


 a workflow -- to visualise , specify, construct, and
document business processes
 an operation -- to model the details of a computation
involved with parameters of the operations and its local
objects

Object-Oriented Software Systems Engineering – Chapter 6 Slide 3


Activity Diagrams

 Activity
 a sort of state which is left by the previous activity
 activity can involve many steps, including waiting for
events
 Transition
 an arrow line without label
 actions are included in activities rather than on the
transition
 Synchronisation bar
 describing the co-ordination of activities
 waiting for all the subtasks to finish before proceeding
(join),
 starting several subtasks in parallel (fork)

Object-Oriented Software Systems Engineering – Chapter 6 Slide 4


Activity Diagrams

 Decision activity
 an alternative to guard conditions on separate transitions
leaving the same state
 Swimlanes and partitions
 several groups of related activities
 these activities are related according to which objects or
actors perform them
 Start and stop

Object-Oriented Software Systems Engineering – Chapter 6 Slide 5


Activity Diagrams
Decision activity

Activity 1 Activity 2
[condition 1]
start [condition 2]

Activity 3

Activity 4 Activity 5

Synchronisation bar

stop
Object-Oriented Software Systems Engineering – Chapter 6 Slide 6
Activity Diagrams - modelling workflow

 Establish a focus for the workflow to show all


interesting activities in one diagram
 Select the business objects that have high-level
responsibility for the parts of the overall workflow,
and each important business object is associated
with a swimlane
 Identify the pre-conditions and post-conditions of
the workflow
 Specify the activities and actions that take place
over time

Object-Oriented Software Systems Engineering – Chapter 6 Slide 7


Activity Diagrams - modelling workflow

 Provide a separate activity diagram to expand


complicated actions or set of actions
 Consider branching activities with forking and
joining
 There are more advanced features

Object-Oriented Software Systems Engineering – Chapter 6 Slide 8


Activity Diagrams - modelling an operation

 Collect the abstractions that are involved in the


operation (parameters, return type, attributes)
 Identify pre & post conditions & any invariants
 Beginning at the operations initial state, specify
the activity & actions that take place over time &
render them in an activity diagram as either
activity states or action states
 Use branching as necessary to specify conditional
paths and iteration
 Use forking and joining as necessary to specify
parallel flows of control

Object-Oriented Software Systems Engineering – Chapter 6 Slide 9


Activity Diagrams - Example

[joined bank]

log on

second level
authorisation

make manage
payment instruction

Object-Oriented Software Systems Engineering – Chapter 6 Slide 10


Library Users Librarian Activity diagrams
[borrow] Find book Example
on shelf
[return]

Wait in
queue

[returning]

[borrowing]
Record Put book
return back on shelf

Spot the mistakes!


Record
borrowing
Prepare for
next user

Object-Oriented Software Systems Engineering – Chapter 6 Slide 11


Customer Sales Warehouse

Request product

Process order Pull materials

Ship order

Receive order Bill customer

Pay bill
Activity diagrams
Close order
- Example

Object-Oriented Software Systems Engineering – Chapter 6 Slide 12


Activity diagrams
- Example 4

[grade >= 40]

print “Failed”
[false]

[true]

print “Passed”

Object-Oriented Software Systems Engineering – Chapter 6 Slide 13


Activity Diagrams - Example

[grade >= 40]

print “Failed”
[false]

[true]

print “Passed”

Object-Oriented Software Systems Engineering – Chapter 6 Slide 14


More About Activity Diagrams

 Suitable for:
 Analysing a use case
 Understand what actions need to take place
 Describe the behavioural dependencies between objects
 Allocate operations to objects within interactive diagrams
 Understanding workflow across many cases
 Representing use cases interacting with each other
 Dealing with multithreaded applications
 Not suitable for:
 Trying to see how objects collaborate – use collaboration
diagrams instead
 Trying to see how an object behaves over its lifetime –
use state diagrams instead

Object-Oriented Software Systems Engineering – Chapter 6 Slide 15


Summary

In this chapter we have:


 Introduced Activity Diagrams
 Discussed where activity diagrams are used

Object-Oriented Software Systems Engineering – Chapter 6 Slide 16

You might also like