6. activity diagrams
description
Transcript of 6. activity diagrams
Slide 1Object-Oriented Software Systems Engineering – Chapter 6
Activity Diagrams
Chapter 6
Slide 2Object-Oriented Software Systems Engineering – Chapter 6
Objectives
In this chapter we will: Introduce Activity Diagrams Discuss where activity diagrams are used
Slide 3Object-Oriented Software Systems Engineering – Chapter 6
Activity Diagrams
Use activity diagrams in the context of system as wholea subsysteman operation
Model dynamic aspect of a system in two waysa 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
Slide 4Object-Oriented Software Systems Engineering – Chapter 6
Activity Diagrams
Activitya sort of state which is left by the previous activityactivity can involve many steps, including waiting for
events Transition
an arrow line without labelactions are included in activities rather than on the
transition Synchronisation bar
describing the co-ordination of activitieswaiting for all the subtasks to finish before proceeding
(join), starting several subtasks in parallel (fork)
Slide 5Object-Oriented Software Systems Engineering – Chapter 6
Activity Diagrams
Decision activityan alternative to guard conditions on separate transitions
leaving the same state Swimlanes and partitions
several groups of related activitiesthese activities are related according to which objects or
actors perform them Start and stop
Slide 6Object-Oriented Software Systems Engineering – Chapter 6
Activity Diagrams
Activity 4
Activity 1
[condition 2]start
stop
[condition 1]
Activity 3
Activity 2
Decision activity
Synchronisation bar
Activity 5
Slide 7Object-Oriented Software Systems Engineering – Chapter 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
Slide 8Object-Oriented Software Systems Engineering – Chapter 6
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
Slide 9Object-Oriented Software Systems Engineering – Chapter 6
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
Slide 10Object-Oriented Software Systems Engineering – Chapter 6
Activity Diagrams - Example
log on
second levelauthorisation
manageinstruction
makepayment
[joined bank]
Slide 11Object-Oriented Software Systems Engineering – Chapter 6
Activity diagramsExample
Library Users Librarian
Find book on shelf
Put bookback on shelf
Record return
Wait in queue
Record borrowing
Prepare for next user
[borrow]
[return]
[bor
row
ing]
[returning]
Spot the mistakes!
Slide 12Object-Oriented Software Systems Engineering – Chapter 6
Customer Sales Warehouse
Request product
Process order Pull materials
Ship order
Bill customerReceive order
Pay bill
Close order Activity diagrams
- Example
Slide 13Object-Oriented Software Systems Engineering – Chapter 6
[false]
[true]
print “Failed”
print “Passed”
[grade >= 40]
Activity diagrams- Example 4
Slide 14Object-Oriented Software Systems Engineering – Chapter 6
Activity Diagrams - Example
[false]
[true]
print “Failed”
print “Passed”
[grade >= 40]
Slide 15Object-Oriented Software Systems Engineering – Chapter 6
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 insteadTrying to see how an object behaves over its lifetime –
use state diagrams instead
Slide 16Object-Oriented Software Systems Engineering – Chapter 6
Summary
In this chapter we have: Introduced Activity Diagrams Discussed where activity diagrams are used