activity diagram tutorial

64
Using Activity Diagrams to Model Use Cases Visually Part 1: The Basics by Declan Chellar

Upload: declan-chellar

Post on 26-Aug-2014

25.476 views

Category:

Self Improvement


3 download

DESCRIPTION

Introduction to using activity diagrams to model use cases visually.

TRANSCRIPT

Page 1: Activity diagram tutorial

Using Activity Diagrams toModel Use Cases Visually

Part 1: The Basics

by Declan Chellar

Page 2: Activity diagram tutorial
Page 3: Activity diagram tutorial

START POINT

Page 4: Activity diagram tutorial

The Start Point represents the

EVENT that triggers the use case.

Page 5: Activity diagram tutorial

Label the Start Point to make the INTENT and

TRIGGER of the use case explicit.

Page 6: Activity diagram tutorial

Actor elects to Add Customer

Page 7: Activity diagram tutorial

END POINT

Actor elects to Add Customer

Page 8: Activity diagram tutorial

Actor elects to Add Customer

Label the End Point to EXPLICITLY confirm that the intent of the use case has

been achieved.

Page 9: Activity diagram tutorial

Actor elects to Add Customer

Customer added

Page 10: Activity diagram tutorial

Actor elects to Add Customer

Customer added

This makes it clear to the reader that the use case is complete and that nothing further is needed in order

to fulfil the intent.

Page 11: Activity diagram tutorial

Actor elects to Add Customer

End of processNOT a good label for an End Point

Page 12: Activity diagram tutorial

To reach the End Point…

Page 13: Activity diagram tutorial

… you need to model STEPS.

Page 14: Activity diagram tutorial

Link the steps with TRANSITIONS.

Page 15: Activity diagram tutorial
Page 16: Activity diagram tutorial

Transitions use arrow heads to show the

direction of process flow.

Page 17: Activity diagram tutorial

I like to put a note against any step that achieves

the goal of the use case.

Goal X achieved

Page 18: Activity diagram tutorial

… because it might not be the last step.

Goal X achieved

Page 19: Activity diagram tutorial

The most common route from the start

point to the end point has many names.

Page 20: Activity diagram tutorial

But they effectively mean the same thing.

Page 21: Activity diagram tutorial

PRIMARY…

BASIC…

TYPICAL…

…PATH

…FLOW

…COURSE OF EVENTS

Combine any word on the left with any phrase on the

right.

…SCENARIO

Page 22: Activity diagram tutorial

Often in a use case the System has to make a

decision based on business rules...

Page 23: Activity diagram tutorial

The actual decision takes place within a

STEP

Page 24: Activity diagram tutorial

System determines

whether X or Y The actual decision takes place within a

STEP

Page 25: Activity diagram tutorial

System determines

whether X or Y A DECISION POINT is then used to help the reader navigate the

diagram.

Page 26: Activity diagram tutorial

DECISION POINT

Page 27: Activity diagram tutorial

Decision Points contain text which describes

the nature of the decision to be made.

Page 28: Activity diagram tutorial

So was it X or Y?

Page 29: Activity diagram tutorial

Decision points allow the flow to branch

away from the Primary Path.

Page 30: Activity diagram tutorial

[Condition 2]

[Condition 1]

Transitions coming out of Decision

Points must have a GUARD.

Page 31: Activity diagram tutorial

[IT WAS “Y”]

[IT WAS “X”]

A Guard needs to explicitly describe a

condition which must be true in order to proceed

down that path.

Page 32: Activity diagram tutorial

[Condition 2]

[Condition 1]

If the flow rejoins the Primary Path, it is known as an Alternate Path.

Page 33: Activity diagram tutorial

[Condition 2]

[Condition 1]

With Alternate Paths, the goal of

the Use Case is still achieved.

Page 34: Activity diagram tutorial

[Condition 2]

[Condition 1]

There are other names for

Alternate Paths.

Page 35: Activity diagram tutorial

[Condition 2]

[Condition 1]

ALTERNATE…

ALTERNATIVE…

SECONDARY…

…PATH

…FLOW

…COURSE OF EVENTS

Combine any word on the left with any phrase on the

right.

…SCENARIO

Page 36: Activity diagram tutorial

[Condition 2][Condition 1]

You can show how paths rejoin by using

a MERGE POINT.

Page 37: Activity diagram tutorial

[Condition 2][Condition 1]

You can show how paths rejoin by using

a MERGE POINT.

Page 38: Activity diagram tutorial

[Condition 2][Condition 1]

I don’t like Merge Points because they take up space

without adding clarity.

Page 39: Activity diagram tutorial

[Condition 2][Condition 1]

I prefer to model merging paths like this.

Page 40: Activity diagram tutorial

[Condition 2]

[Condition 1]

Merge Points can sometimes be

particularly superfluous.

Page 41: Activity diagram tutorial

[Condition 2]

[Condition 1]

I think it is neater to show the merge

this way.

Page 42: Activity diagram tutorial

[Condition 2]

[Condition 1]

[Condition 3]

If the flow does NOT rejoin the Primary Path, it is known as an Exception Path.

Page 43: Activity diagram tutorial

[Condition 2]

[Condition 1]

[Condition 3]

With Exception Paths, the goal of

the Use Case is NOT achieved.

Goal X achieved

Page 44: Activity diagram tutorial

[Condition 2]

[Condition 1]

[Condition 3]

With Exception Paths, the goal of

the Use Case is NOT achieved.

Goal X achievedUh, oh!

Page 45: Activity diagram tutorial

[Condition 2][Condition 3]

[Condition 1]

I like to use colour to highlight the different

paths.

Page 46: Activity diagram tutorial

[Condition 1]

[Condition 2][Condition 3]

Page 47: Activity diagram tutorial

[Condition 2]

[Condition 1]

[Condition 3]

Page 48: Activity diagram tutorial

[Condition 3]

This makes it easy to identify test scenarios at a

glance.

[Condition 1]

[Condition 2]

Page 49: Activity diagram tutorial

A1: [Condition 2]

P: [Condition 1]

E1: [Condition 3]

I also like to label the Guards in order to easily

identify the paths.

Page 50: Activity diagram tutorial

P1:

P2: A1.1:E1.1:

A1: [Condition 2]

P: [Condition 1]

E1: [Condition 3]

And I like to label the Steps for easy backward

reference from Business Rules and a Logical Data

Model.

Page 51: Activity diagram tutorial

P1:

P2: A1.1:E1.1:

A1: [Condition 2]

P: [Condition 1]

E1: [Condition 3]

Primary Path: P1, P2.

Page 52: Activity diagram tutorial

P1:

P2: A1.1:E1.1:

A1: [Condition 2]

P: [Condition 1]

E1: [Condition 3]

Primary Path: P1, P2.

Alternate Path 1: P1, A1.1, P2.

Page 53: Activity diagram tutorial

P1:

P2: A1.1:E1.1:

A1: [Condition 2]

P: [Condition 1]

E1: [Condition 3]

Primary Path: P1, P2.

Alternate Path 1: P1, A1.1, P2.

Exception Path 1: P1, E1.1.

Page 54: Activity diagram tutorial

[Condition 2]

[Condition 1]

[Condition 3]

In some Use Cases, you will need to

model parallel steps

Page 55: Activity diagram tutorial

X

[Condition 2]

[Condition 1]

[Condition 3]

A B

In this example, steps A and B must both start after step

X finishes and must both finish before the Use Case

ends.

Page 56: Activity diagram tutorial

X

[Condition 2]

[Condition 1]

[Condition 3]

A B

But we do not care about the order in

which A and B happen.

Page 57: Activity diagram tutorial

X

[Condition 2]

[Condition 1]

[Condition 3]

A B

A and B could even happen at the

same time.

Page 58: Activity diagram tutorial

[Condition 2]

[Condition 1]

[Condition 3]

A C

B

In this example, B must follow A, but we do not care when C happens in

relation to (A + B).

Page 59: Activity diagram tutorial

[Condition 2]

[Condition 1]

[Condition 3]

A

B

In some Use Cases, you will need to model

repeated steps.

Page 60: Activity diagram tutorial

[Condition 2]

[Condition 1]

[Condition 3]

A

B

For each X:

In this example, you repeat (A + B) until there is no more X.

Page 61: Activity diagram tutorial

[Condition 2]

[Condition 1]

[Condition 3]

A

B

For each X:

For example, you might do this when

adding passengers to a holiday booking.

Page 62: Activity diagram tutorial

Let’s review the shapes

Page 63: Activity diagram tutorial

[Condition]

For each X:

START POINT

END POINT

STEP

TRANSITION

DECISION POINT

GUARD

REPEATED STEPS

PARALLEL STEPS

Page 64: Activity diagram tutorial

www.chellar.com/blog