Activity Diagram Chapter 5 Introduction l An activity

  • Slides: 19
Download presentation
Activity Diagram Chapter 5

Activity Diagram Chapter 5

Introduction l An activity diagram is essentially a flowchart, showing flow of control from

Introduction l An activity diagram is essentially a flowchart, showing flow of control from activity to activity. l An activity represents an operation on some class in the system that results in a change in the state of the system. l Typically, activity diagrams are used to model workflow or business processes and internal operation. l Graphically, an activity diagram is a collection of vertices and arcs.

Introduction Activity Diagram commonly contain l Activity states and Action States. l Transitions. l

Introduction Activity Diagram commonly contain l Activity states and Action States. l Transitions. l Objects.

Action State Action state represent the execution of an action. Action states cant be

Action State Action state represent the execution of an action. Action states cant be decomposed. Activity State An activity is the specification of a parameterized sequence of behaviour. An activity is shown as a round-cornered rectangle enclosing all the actions, control flows and other elements that make up the activity. Action states are atomic, meaning Activity states are composite whose that events may occur, but the work flow of control is made up of other of the action state is not interrupted. activity states and action states. Work of action state is generally Activity state can take some considered to take insignificant time. duration to complete Example of action states: -create Example : process bill and destroy object, send a signal to an object, evaluate an expression.

Example Index: =lookup(e)+7 Action state Process order Activity state

Example Index: =lookup(e)+7 Action state Process order Activity state

Process Order Receive order Order rejected A Order accepted Fill order Ship order Send

Process Order Receive order Order rejected A Order accepted Fill order Ship order Send invoice Invoice Close order A Make payment Accept payment

Transitions When the action or activity of a state completes , flow of control

Transitions When the action or activity of a state completes , flow of control passes immediately to the next action or activity state. This is shown with the help of transitions. Transition is shown as a simple directed line.

Transition types l Control Flow A control flow shows the flow of control from

Transition types l Control Flow A control flow shows the flow of control from one action to the next. Its notation is a line with an arrowhead. l Initial Node An initial or start node is depicted by a large black spot, as shown below.

Final Node l There are two types of final node: activity and flow final

Final Node l There are two types of final node: activity and flow final nodes. The activity final node is depicted as a circle with a dot inside. l The flow final node is depicted as a circle with a cross inside. The difference between the two node types is that the flow final node denotes the end of a single control flow; the activity final node denotes the end of all control flows within the activity.

l Objects and Object Flows An object flow is a path along which objects

l Objects and Object Flows An object flow is a path along which objects or data can pass. An object is shown as a rectangle. l An object flow is shown as a connector with an arrowhead denoting the direction the object is being passed.

l An object flow must have an object on at least one of its

l An object flow must have an object on at least one of its ends. A shorthand notation for the above diagram would be to use input and output pins. l A data store is shown as an object with the «datastore» keyword

Decision Node & Merge Node l Decision nodes and merge nodes have the same

Decision Node & Merge Node l Decision nodes and merge nodes have the same notation: a diamond shape. They can both be named. The control flows coming away from a decision node will have guard conditions which will allow control to flow if the guard condition is met. The following diagram shows use of a decision node and a merge node.

Fork & Join Nodes l Forks and joins have the same notation: either a

Fork & Join Nodes l Forks and joins have the same notation: either a horizontal or vertical bar (the orientation is dependent on whether the control flow is running left to right or top to bottom). Joins & fork should balance, i. e the number of flows that leave a fork should match the number of flows that enter its corresponding join. fork join

Exception Handler l Exception Handlers can be modeled on activity diagrams as in the

Exception Handler l Exception Handlers can be modeled on activity diagrams as in the example below.

Interruptible Activity region An interruptible activity region surrounds a group of actions that can

Interruptible Activity region An interruptible activity region surrounds a group of actions that can be interrupted. In the very simple example below, the "Process Order" action will execute until completion, when it will pass control to the "Close Order" action, unless a "Cancel Request" interrupt is received, which will pass control to the "Cancel Order" action.

Swim. Lanes l An activity partition is shown as either a horizontal or vertical

Swim. Lanes l An activity partition is shown as either a horizontal or vertical swimlane. In the following diagram, the partitions are used to separate actions within an activity into those performed by the accounting department and those performed by the customer.

Customer Sales Warehouse Request product Process order Pull Materials Ship order Receive order Pay

Customer Sales Warehouse Request product Process order Pull Materials Ship order Receive order Pay Bill customer Close order

Customer Sales Warehouse Request product Process order Pull Materials O: Order [in progress] Receive

Customer Sales Warehouse Request product Process order Pull Materials O: Order [in progress] Receive order Ship order O: Order [filled] Bill customer object Pay Bill Close order state

Example Customer wants to make a purchase of various items online. Valid customer can

Example Customer wants to make a purchase of various items online. Valid customer can make a purchase online. System provides the catalog for item selection if needed. While ordering for products customer has to provide personal details. Customer makes cash or card payment for his order.