6. activity diagrams

16
Slide 1 Object-Oriented Software Systems Engineering – Chapter 6 Activity Diagrams Chapter 6

description

 

Transcript of 6. activity diagrams

Page 1: 6. activity diagrams

Slide 1Object-Oriented Software Systems Engineering – Chapter 6

Activity Diagrams

Chapter 6

Page 2: 6. activity diagrams

Slide 2Object-Oriented Software Systems Engineering – Chapter 6

Objectives

In this chapter we will: Introduce Activity Diagrams Discuss where activity diagrams are used

Page 3: 6. activity diagrams

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

Page 4: 6. activity diagrams

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)

Page 5: 6. activity diagrams

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

Page 6: 6. activity diagrams

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

Page 7: 6. activity diagrams

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

Page 8: 6. activity diagrams

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

Page 9: 6. activity diagrams

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

Page 10: 6. activity diagrams

Slide 10Object-Oriented Software Systems Engineering – Chapter 6

Activity Diagrams - Example

log on

second levelauthorisation

manageinstruction

makepayment

[joined bank]

Page 11: 6. activity diagrams

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!

Page 12: 6. activity diagrams

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

Page 13: 6. activity diagrams

Slide 13Object-Oriented Software Systems Engineering – Chapter 6

[false]

[true]

print “Failed”

print “Passed”

[grade >= 40]

Activity diagrams- Example 4

Page 14: 6. activity diagrams

Slide 14Object-Oriented Software Systems Engineering – Chapter 6

Activity Diagrams - Example

[false]

[true]

print “Failed”

print “Passed”

[grade >= 40]

Page 15: 6. activity diagrams

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

Page 16: 6. activity diagrams

Slide 16Object-Oriented Software Systems Engineering – Chapter 6

Summary

In this chapter we have: Introduced Activity Diagrams Discussed where activity diagrams are used