uml activity diagrams - abelski.com › courses › uml21 › activity.pdf · when dealing with big...

114
© 2008 Haim Michael. All Rights Reserved. UML Activity Diagrams

Upload: others

Post on 25-Jun-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

UML Activity Diagrams

Page 2: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Introduction

The UML activity diagram presents the system's execution flow.

The activity diagram presents activities composed of one or more

small actions.

Page 3: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Activity

The notation used for activity is a rectangle with rounded corners.

In the upper left corner we specify the activity name.

Below the name it is possible to list the involved parameters. It is

also possible to use parameter nodes instead (explained later).

Page 4: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Actions

Within the activity notation it is possible to draw the actions that

belong to this activity.

The notation used for action is the same notation we use for

activity.

Page 5: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Initial Node

Each activity starts with the initial node. The initial node notation

is a small black circle.

Page 6: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Decision Node

A decision node chooses an output flow from different available

output flows based on its boolean expression (guard condition)

value.

Each decision node has one input edge and multiple output ones.

The notation is an empty diamond. We put the boolean

expression (guard condition) in brackets.

A note can be added in order to present more info about the

decision input.

Page 7: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Decision Node

Page 8: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Merge Node

A merge node unite the flows it receives into one single flow. It

has multiple incoming edges and one output edge only.

The notation for showing a merge node is an empty diamond.

Page 9: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Merge Node

Page 10: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Merge Node

Page 11: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Fork Node

A fork node split a flow into multiple concurrent flows.

Unlike the merge node, the fork node duplicates each data item it

receives and forward each copy through each one of the

outgoing flows.

Page 12: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Fork Node

Page 13: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Join Node

A join node synchronizes multiple flows (edges) back to a single

flow (edge).

The notation used for Join node is the same notation used for the

fork node.

Page 14: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Join Node

Page 15: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Join Node

Near the join node it is possible to write a condition within braces

{ } in order to inform of a condition that must be true before the

join node forward the flow.

Page 16: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Join Node

Page 17: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Activity Final Node

The activity final node is a node that any flow of data that reaches

it will cause the termination of the entire application.

The notation used to draw an activity final node is a black circle

with a black ring around it.

Page 18: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Flow Final Node

The flow final node is a node that terminates a flow only. Data

that reaches it won't terminate the application.

The notation used to draw a flow final node is a black ring with X

inside it.

Page 19: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Flow Final Node

Page 20: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Loops

The loop node usually includes three parts: setup, body & test.

The setup part executes only once (when the loop starts) and it

usually initializes the loop. The test part is evaluated before the

body part of after it.

Page 21: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Loops

Page 22: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Preconditions & Postconditions

Each activity can be specified together with its preconditions and

postconditions.

We write the precondition on top center of the diagram using the

following format:

<<precondition>> _______

We write the postcondition on top center of the diagram (below

the precondition) using the following format:

<<postcondition>> _______

Page 23: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Preconditions & Postconditions

Buying On The Web <<precondition>> credit card is valid<<postcondition>> product is shipped

Page 24: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Activities Edges

The activities edges are lines with open arrows that connect the

activities with each other and represent the control and data flows

from one activity to the other.

<<precondition>> credit card is valid<<postcondition>> product is shipped

Buying On The Web

Page 25: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Object Flow ElementsThe object flow element presents a special flow of one of the

following possibilities:1. A flow through which only objects that meet a selection condition can move forward.

2. A flow that is multi casted to a multiple instances.

3. A flow that is multi received from multiple senders.

4. A flow that transforms the data flow and add specific data to it.

We use a simple small empty circle placed above the activity

edge together with a note in which we write <<selection>> or

<<multi cast>> or <<multi receive>> or <<transforms>>.

Page 26: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Object Flow Elements

<<selection>>

Page 27: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Object Flow Elements

<<transformation>>

Page 28: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Object Flow Elements

<<multicast>> <<multireceive>>

Page 29: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Connectors

When dealing with big activity diagrams that can't be captured in

one page or when drawing an activity edge is too complex due to

a big number of other elements our diagram includes, it is

possible to split the activity edge using a connector.

The connector notation is a simple circle within we write its name.

Page 30: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Connectors

Page 31: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Tokens & Weight

Conceptually along the activities edges the flowing data can be

perceived as tokens.

Conceptually, each action that is performed has data input and

data output that can be represented as tokens.

We can represent the number of tokens that should be made

available for a given action before it can be executed by writing

{weight=n} above the relevant activity edge, while n is the

number of the required tokens.

Page 32: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Tokens & Weight

Page 33: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Activity Edge Guard Condition

On top of each activity edge we can add a guard condition that

will be checked the moment the required weight is met.

If one (or more) of the tokens fail(s) to pass the guard condition

and the total number of tokens that pass doesn't meet the

required weight then all tokens that passed will be held until the

weight requirement is met.

The notation for a guard condition includes a boolean expression

within square brackets we draw near the relevant activity edge.

Page 34: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Activity Edge Guard Condition

Page 35: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Parameter Node

We can depict a parameter sent/received to/from another activity

by drawing a parameter node.

A parameter node notation includes a simple rectangle within we

write the parameter name (or description).

Given an activity with input & output parameters, the input

parameter is connected (edged) with the first action. The output

parameter is connected (edged) with the last action.

Page 36: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Parameter Node

Oranges Squize Juice Pack Juice Juice

Page 37: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Object Node

We can depict an object instantiated from one of our designed

classes with the same notation we use to represent a parameter.

It is common to name the object node with the same name as its

type.

Page 38: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Pins

Pin is a special object node that represents an object that is used

as input/output to/from an action.

The notation for pin is the same notation used for Object, just in a

smaller dimension. In addition, the pin is drawn as part of an

action and any edge that connects an action via a pin should

connect the pin (instead of the action).

Page 39: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Pins

Page 40: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Input \ Output Pin

Within the pin you can draw a small arrow to display whether it is

an input (or output) pin. Excellent solution for those cases in

which there is no leading line.

Page 41: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Exception Handling

Representing an error output (exception) can be done using an

exception pin.

The notation for exception pin is the same notation we use for a

simple pin, just that we add a small triangle (in a shape of arrow

pointing up) near it.

Page 42: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Exception Handling

Page 43: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Exception Handling

An alternate possibility to depict exceptions and exceptions

handling is by drawing a line shaped as a strike coming out of the

activity where the exception can happen and lead to another

activity that will be executed when the exception happens.

Page 44: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Exception Handling

FileNotFoundException

Page 45: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Activity Partitions

The activity diagram can be divided into partitions (swim lanes).

Separating the activity diagram into separated partitions can be

done based on the business unit responsible for each activity,

based on the manager responsible for each activity and/or base

on any other criteria we set.

Each partition can be labeled to indicate on what we have based

the partition separation (swim lanes).

Page 46: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Activity Partitions

If an activity shown in one of the partitions is beyond the scope of

our work we can add the <<external>> stereotype to that activity.

Page 47: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Activity Partitions

Page 48: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Activity Partitions

Activity partitions can be implemented in two dimensions by

dividing the activity diagram both horizontally and vertically.

Page 49: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Activity Partitions

Page 50: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Streaming Action

An action / activity is count to be a streaming one if it can

produce the output while processing the input at the same time.

We depict a streaming action / activity by adding {stream} both

to its input and its output.

Alternatively, we can also depict a streaming action / activity by

drawing the pins as black rectangles instead of empty ones.

Page 51: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Streaming Action

{stream} {stream}

Page 52: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Central Buffer Node

A central buffer node, depicted using a simple rectangle with the

<<centralBuffer>> stereotype on top and the object type

below, represents an object that receives input data (mostly from

more than one source) and buffers it forward (mostly to more

than one destination) while either sorting the data or prioritizing it

between its output edges.

Page 53: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Central Buffer Node

Page 54: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Data Store Node

A data store node is a variation of a central buffer node. A data

store node copies all data that goes through it (e.g. Logs DB).

The notation used for data store node is the same notation used

for object... only with the “<<datastore>>” stereotype.

According to UML 2.0 specification, if the same data passes

again it will overwrite the previous log.

Page 55: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Data Store Node

Page 56: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Expansion Regions

When having an action (or set of actions) that execute over a

collection of input data we can show that by placing the action (or

the set of actions) within an expansion region.

An expansion region is showed using a dashed rectangle with

rounded corners surrounding the action (or the set of actions). In

addition, we should place a row of four input pins on the dashed

boundary and connect it with a simple line to the first internal

action, and do the same connecting the last action to a row of

four output pins on the other side's dashed boundary.

Page 57: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

© 2008 Haim Michael. All Rights Reserved.

Expansion Regions

Page 58: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 1

07/25/10 © 2008 Haim Michael. All Rights Reserved. 1

UML Activity Diagrams

Page 59: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 2

07/25/10 © 2008 Haim Michael. All Rights Reserved. 2

Introduction

The UML activity diagram presents the system's execution flow.

The activity diagram presents activities composed of one or more

small actions.

Page 60: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 3

07/25/10 © 2008 Haim Michael. All Rights Reserved. 3

Activity

The notation used for activity is a rectangle with rounded corners.

In the upper left corner we specify the activity name.

Below the name it is possible to list the involved parameters. It is

also possible to use parameter nodes instead (explained later).

Page 61: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 4

07/25/10 © 2008 Haim Michael. All Rights Reserved. 4

Actions

Within the activity notation it is possible to draw the actions that

belong to this activity.

The notation used for action is the same notation we use for

activity.

Page 62: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 5

07/25/10 © 2008 Haim Michael. All Rights Reserved. 5

Initial Node

Each activity starts with the initial node. The initial node notation

is a small black circle.

Page 63: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 6

07/25/10 © 2008 Haim Michael. All Rights Reserved. 6

Decision Node

A decision node chooses an output flow from different available

output flows based on its boolean expression (guard condition)

value.

Each decision node has one input edge and multiple output ones.

The notation is an empty diamond. We put the boolean

expression (guard condition) in brackets.

A note can be added in order to present more info about the

decision input.

Page 64: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 7

07/25/10 © 2008 Haim Michael. All Rights Reserved. 7

Decision Node

Page 65: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 8

07/25/10 © 2008 Haim Michael. All Rights Reserved. 8

Merge Node

A merge node unite the flows it receives into one single flow. It

has multiple incoming edges and one output edge only.

The notation for showing a merge node is an empty diamond.

Page 66: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 9

07/25/10 © 2008 Haim Michael. All Rights Reserved. 9

Merge Node

Page 67: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 10

07/25/10 © 2008 Haim Michael. All Rights Reserved. 10

Merge Node

Page 68: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 11

07/25/10 © 2008 Haim Michael. All Rights Reserved. 11

Fork Node

A fork node split a flow into multiple concurrent flows.

Unlike the merge node, the fork node duplicates each data item it

receives and forward each copy through each one of the

outgoing flows.

Page 69: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 12

07/25/10 © 2008 Haim Michael. All Rights Reserved. 12

Fork Node

Page 70: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 13

07/25/10 © 2008 Haim Michael. All Rights Reserved. 13

Join Node

A join node synchronizes multiple flows (edges) back to a single

flow (edge).

The notation used for Join node is the same notation used for the

fork node.

Page 71: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 14

07/25/10 © 2008 Haim Michael. All Rights Reserved. 14

Join Node

This diagram describes a ski left for three people that doesn't move till all three people sit.

Page 72: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 15

07/25/10 © 2008 Haim Michael. All Rights Reserved. 15

Join Node

Near the join node it is possible to write a condition within braces

{ } in order to inform of a condition that must be true before the

join node forward the flow.

Page 73: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 16

07/25/10 © 2008 Haim Michael. All Rights Reserved. 16

Join Node

This diagram describes a ski lift for three people that doesn't move till all three people sit and the security belt of each one of them is active.

Page 74: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 17

07/25/10 © 2008 Haim Michael. All Rights Reserved. 17

Activity Final Node

The activity final node is a node that any flow of data that reaches

it will cause the termination of the entire application.

The notation used to draw an activity final node is a black circle

with a black ring around it.

Page 75: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 18

07/25/10 © 2008 Haim Michael. All Rights Reserved. 18

Flow Final Node

The flow final node is a node that terminates a flow only. Data

that reaches it won't terminate the application.

The notation used to draw a flow final node is a black ring with X

inside it.

Page 76: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 19

07/25/10 © 2008 Haim Michael. All Rights Reserved. 19

Flow Final Node

Page 77: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 20

07/25/10 © 2008 Haim Michael. All Rights Reserved. 20

Loops

The loop node usually includes three parts: setup, body & test.

The setup part executes only once (when the loop starts) and it

usually initializes the loop. The test part is evaluated before the

body part of after it.

Page 78: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 21

07/25/10 © 2008 Haim Michael. All Rights Reserved. 21

Loops

Page 79: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 22

07/25/10 © 2008 Haim Michael. All Rights Reserved. 22

Preconditions & Postconditions

Each activity can be specified together with its preconditions and

postconditions.

We write the precondition on top center of the diagram using the

following format:

<<precondition>> _______

We write the postcondition on top center of the diagram (below

the precondition) using the following format:

<<postcondition>> _______

Page 80: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 23

07/25/10 © 2008 Haim Michael. All Rights Reserved. 23

Preconditions & Postconditions

Buying On The Web <<precondition>> credit card is valid<<postcondition>> product is shipped

As with activities, we can add the preconditions and the postconditions to actions as well.

Specifying the preconditions and the postconditions – both for activities and for actions - using notes (labeled with <<precondition>> and <<postcondition>> accordingly) is feasible as well.

Page 81: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 24

07/25/10 © 2008 Haim Michael. All Rights Reserved. 24

Activities Edges

The activities edges are lines with open arrows that connect the

activities with each other and represent the control and data flows

from one activity to the other.

<<precondition>> credit card is valid<<postcondition>> product is shipped

Buying On The Web

As with activities, we can add the preconditions and the postconditions to actions as well.

Specifying the preconditions and the postconditions – both for activities and for actions - using notes (labeled with <<precondition>> and <<postcondition>> accordingly) is feasible as well.

Page 82: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 25

07/25/10 © 2008 Haim Michael. All Rights Reserved. 25

Object Flow ElementsThe object flow element presents a special flow of one of the

following possibilities:1. A flow through which only objects that meet a selection condition can move forward.

2. A flow that is multi casted to a multiple instances.

3. A flow that is multi received from multiple senders.

4. A flow that transforms the data flow and add specific data to it.

We use a simple small empty circle placed above the activity

edge together with a note in which we write <<selection>> or

<<multi cast>> or <<multi receive>> or <<transforms>>.

When it is a <<selection>> object flow we will write the condition below the <<selection>> title.

When it is a <<transformation>> object flow we will add the additional data below the <<transformation>> title.

Page 83: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 26

07/25/10 © 2008 Haim Michael. All Rights Reserved. 26

Object Flow Elements

<<selection>>

Page 84: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 27

07/25/10 © 2008 Haim Michael. All Rights Reserved. 27

Object Flow Elements

<<transformation>>

Page 85: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 28

07/25/10 © 2008 Haim Michael. All Rights Reserved. 28

Object Flow Elements

<<multicast>> <<multireceive>>

Page 86: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 29

07/25/10 © 2008 Haim Michael. All Rights Reserved. 29

Connectors

When dealing with big activity diagrams that can't be captured in

one page or when drawing an activity edge is too complex due to

a big number of other elements our diagram includes, it is

possible to split the activity edge using a connector.

The connector notation is a simple circle within we write its name.

Page 87: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 30

07/25/10 © 2008 Haim Michael. All Rights Reserved. 30

Connectors

Page 88: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 31

07/25/10 © 2008 Haim Michael. All Rights Reserved. 31

Tokens & Weight

Conceptually along the activities edges the flowing data can be

perceived as tokens.

Conceptually, each action that is performed has data input and

data output that can be represented as tokens.

We can represent the number of tokens that should be made

available for a given action before it can be executed by writing

{weight=n} above the relevant activity edge, while n is the

number of the required tokens.

Page 89: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 32

07/25/10 © 2008 Haim Michael. All Rights Reserved. 32

Tokens & Weight

The ski elevator to Hermon peak has 20 seats. Only when 20 people enter that elevator it

starts moving.

Page 90: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 33

07/25/10 © 2008 Haim Michael. All Rights Reserved. 33

Activity Edge Guard Condition

On top of each activity edge we can add a guard condition that

will be checked the moment the required weight is met.

If one (or more) of the tokens fail(s) to pass the guard condition

and the total number of tokens that pass doesn't meet the

required weight then all tokens that passed will be held until the

weight requirement is met.

The notation for a guard condition includes a boolean expression

within square brackets we draw near the relevant activity edge.

Page 91: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 34

07/25/10 © 2008 Haim Michael. All Rights Reserved. 34

Activity Edge Guard Condition

Assuming that our ski elevator is limited for people above 13 we can depict this fact by adding a guard condition associated with the edge that connects the two activities.

Page 92: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 35

07/25/10 © 2008 Haim Michael. All Rights Reserved. 35

Parameter Node

We can depict a parameter sent/received to/from another activity

by drawing a parameter node.

A parameter node notation includes a simple rectangle within we

write the parameter name (or description).

Given an activity with input & output parameters, the input

parameter is connected (edged) with the first action. The output

parameter is connected (edged) with the last action.

Page 93: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 36

07/25/10 © 2008 Haim Michael. All Rights Reserved. 36

Parameter Node

Oranges Squize Juice Pack Juice Juice

Page 94: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 37

07/25/10 © 2008 Haim Michael. All Rights Reserved. 37

Object Node

We can depict an object instantiated from one of our designed

classes with the same notation we use to represent a parameter.

It is common to name the object node with the same name as its

type.

In this diagram we can see the object soup. Please note the lines connected the activities with the object should be plain ones. Yet, the tool I used (StarUML) nor others I have (e.g. Netbeans) support that feature.

Page 95: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 38

07/25/10 © 2008 Haim Michael. All Rights Reserved. 38

Pins

Pin is a special object node that represents an object that is used

as input/output to/from an action.

The notation for pin is the same notation used for Object, just in a

smaller dimension. In addition, the pin is drawn as part of an

action and any edge that connects an action via a pin should

connect the pin (instead of the action).

Page 96: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 39

07/25/10 © 2008 Haim Michael. All Rights Reserved. 39

Pins

Page 97: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 40

07/25/10 © 2008 Haim Michael. All Rights Reserved. 40

Input \ Output Pin

Within the pin you can draw a small arrow to display whether it is

an input (or output) pin. Excellent solution for those cases in

which there is no leading line.

Page 98: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 41

07/25/10 © 2008 Haim Michael. All Rights Reserved. 41

Exception Handling

Representing an error output (exception) can be done using an

exception pin.

The notation for exception pin is the same notation we use for a

simple pin, just that we add a small triangle (in a shape of arrow

pointing up) near it.

Page 99: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 42

07/25/10 © 2008 Haim Michael. All Rights Reserved. 42

Exception Handling

Page 100: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 43

07/25/10 © 2008 Haim Michael. All Rights Reserved. 43

Exception Handling

An alternate possibility to depict exceptions and exceptions

handling is by drawing a line shaped as a strike coming out of the

activity where the exception can happen and lead to another

activity that will be executed when the exception happens.

Page 101: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 44

07/25/10 © 2008 Haim Michael. All Rights Reserved. 44

Exception Handling

FileNotFoundException

Page 102: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 45

07/25/10 © 2008 Haim Michael. All Rights Reserved. 45

Activity Partitions

The activity diagram can be divided into partitions (swim lanes).

Separating the activity diagram into separated partitions can be

done based on the business unit responsible for each activity,

based on the manager responsible for each activity and/or base

on any other criteria we set.

Each partition can be labeled to indicate on what we have based

the partition separation (swim lanes).

Page 103: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 46

07/25/10 © 2008 Haim Michael. All Rights Reserved. 46

Activity Partitions

If an activity shown in one of the partitions is beyond the scope of

our work we can add the <<external>> stereotype to that activity.

Page 104: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 47

07/25/10 © 2008 Haim Michael. All Rights Reserved. 47

Activity Partitions

Page 105: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 48

07/25/10 © 2008 Haim Michael. All Rights Reserved. 48

Activity Partitions

Activity partitions can be implemented in two dimensions by

dividing the activity diagram both horizontally and vertically.

Page 106: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 49

07/25/10 © 2008 Haim Michael. All Rights Reserved. 49

Activity Partitions

Page 107: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 50

07/25/10 © 2008 Haim Michael. All Rights Reserved. 50

Streaming Action

An action / activity is count to be a streaming one if it can

produce the output while processing the input at the same time.

We depict a streaming action / activity by adding {stream} both

to its input and its output.

Alternatively, we can also depict a streaming action / activity by

drawing the pins as black rectangles instead of empty ones.

Page 108: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 51

07/25/10 © 2008 Haim Michael. All Rights Reserved. 51

Streaming Action

{stream} {stream}

Page 109: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 52

07/25/10 © 2008 Haim Michael. All Rights Reserved. 52

Central Buffer Node

A central buffer node, depicted using a simple rectangle with the

<<centralBuffer>> stereotype on top and the object type

below, represents an object that receives input data (mostly from

more than one source) and buffers it forward (mostly to more

than one destination) while either sorting the data or prioritizing it

between its output edges.

Page 110: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 53

07/25/10 © 2008 Haim Michael. All Rights Reserved. 53

Central Buffer Node

Though according the spec the lines in this diagram should be plain simple lines the available UML tools at this time don't allow to use. As a result of that the lines depicted in this diagram are dashed ones.

Page 111: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 54

07/25/10 © 2008 Haim Michael. All Rights Reserved. 54

Data Store Node

A data store node is a variation of a central buffer node. A data

store node copies all data that goes through it (e.g. Logs DB).

The notation used for data store node is the same notation used

for object... only with the “<<datastore>>” stereotype.

According to UML 2.0 specification, if the same data passes

again it will overwrite the previous log.

Page 112: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 55

07/25/10 © 2008 Haim Michael. All Rights Reserved. 55

Data Store Node

Page 113: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 56

07/25/10 © 2008 Haim Michael. All Rights Reserved. 56

Expansion Regions

When having an action (or set of actions) that execute over a

collection of input data we can show that by placing the action (or

the set of actions) within an expansion region.

An expansion region is showed using a dashed rectangle with

rounded corners surrounding the action (or the set of actions). In

addition, we should place a row of four input pins on the dashed

boundary and connect it with a simple line to the first internal

action, and do the same connecting the last action to a row of

four output pins on the other side's dashed boundary.

Page 114: UML Activity Diagrams - abelski.com › courses › uml21 › activity.pdf · When dealing with big activity diagrams that can't be captured in one page or when drawing an activity

UML Activity Diagrams 07/25/10

© 2008 Haim Michael. All Rights Reserved. 57

07/25/10 © 2008 Haim Michael. All Rights Reserved. 57

Expansion Regions