chapter 11 activity diagrams. 2 “activity diagrams are a technique to describe procedural logic,...

20
Chapter 11 Activity Diagrams

Upload: bruno-sharp

Post on 17-Jan-2016

233 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

Chapter 11Activity Diagrams

Page 2: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

2

• “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler

• An activity diagram... – models the dynamic aspects of a system.

– serves the same function as a flowchart.

– Is composed of a sequence of actions, possibly concurrent

Introduction

Page 3: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

3

• An activity diagram…– is commonly used to show the actions/steps involved in

carrying out a particular use-case.

– Shows the flow from action to action.

– Commonly contains action states, flows (a.k.a edges and transitions), forks, merges, joins, decisions and objects.

• Decisions…– are used to show alternate flows of control.

– is represented as a diamond. Outgoing transitions are labeled with guard conditions.

Terms and Concepts

Page 4: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

4

• Forking and Joining– A fork is when a single flow of control splits into two

or more parallel (concurrent) flows of control.

– A join is when two or more flows of control merge into a single flow of control.

– A flow of control is also known as a thread.

– A synchronization bar is used to model forking and joining, and is modeled as a thick horizontal or vertical bar.

Terms and Concepts

Page 5: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

5

A Simple Activity DiagramFigure 11.1

Page 6: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

6

• Actions can be decomposed into subactivities– Used as a way to manage complexity

– Indicated by the rake symbol

Decomposing an Action

Page 7: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

7

The Activity Diagram of Figure 11.1 modified to invoke the activity in figure 11.2

Page 8: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

8

• Partitions...– Are used to group actions according to the organization

or class responsible for those actions.

– Are divided by solid vertical lines.

– Can be used in the context of concurrency.

• An activity can only belong to one partition, but transitions between actions may cross partitions.

Partitions (a.k.a. Swimlanes)

Page 9: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

9

Activity Diagram with Partitions

Page 10: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

10

Receiving Signals

• A signal is an event received from an outside process.

• The receipt of the signal triggers the start of an activity

Page 11: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

11

Sending Signals

The activity sends a signal (send itinerary) and then concurrently waits for two separate external signals. The first flow to reach the final state will terminate the other flow.

Page 12: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

12

Tokens

“Control flow is modeled in terms of tokens. The start node will create a token which then goes to next action. After the action executes, the token will go to the next action. When it encounters a fork, the fork will create a token for each of its outbound flows. The opposite happens for joins. It will produce an outbound token once all inbound tokens arrived.” -- http://edutechwiki.unige.ch/en/UML_activity_diagram

Page 13: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

13

Four Ways of Showing an Edge(an edge is another name for transition)

The last two examples are passing an Order object from Receive Invoice to Make Payment

Page 14: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

14

Pins and Transformations

• Actions can have parameters

• Parameters can be modeled as pins

• Pins correspond to the parameter boxed on a decomposed diagram

• Transformations can be used to ensure arguments match parameters

Page 15: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

15

Expansion Region

• An expansion region marks an activity diagram area where actions occur once for each item in a collection

• Once all of the reviewed articles have been placed in the list box pin, a single token is passed to Publish Newsletter

• <<concurrent>> or <<iterative>> stereotypes are commonly used

Page 16: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

16

Expansion Region

• Prepare Article is a shorthand notation for the expansion region in figure 11.9

• <<concurrent>> expansion is assumed by default

Page 17: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

17

Flow Finals

• Within an expansion region a final flow indicates the end of a particular flow with out termination the remaining flows.

• The number of items in the output collection may be less than the number of items in the input collection

Page 18: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

18

Join Specification

• A join specification is a Boolean expression attached to a join

• Each time a token arrives at the join, the join specification is evaluated

Page 19: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

19

• Object Flow– Objects may be attached (using dependencies) to

specific activities in an activity diagram.

– The activity to which an object is connected has a direct effect on the object’s state or lifetime.

– An object’s state may be shown in brackets inside the object rectangle.

Objects and Activity Diagrams

Page 20: Chapter 11 Activity Diagrams. 2 “Activity diagrams are a technique to describe procedural logic, business processes, and work flows” - M. Fowler An activity

20

Activity Diagram with Object Flow Using UML 1 Notation