Presentation is loading. Please wait.

Presentation is loading. Please wait.

Activity diagrams. Introduction ● Activity diagrams are a behavioural model that represent the dynamics of the system. ● An activity diagram is essentially.

Similar presentations


Presentation on theme: "Activity diagrams. Introduction ● Activity diagrams are a behavioural model that represent the dynamics of the system. ● An activity diagram is essentially."— Presentation transcript:

1 Activity diagrams

2 Introduction ● Activity diagrams are a behavioural model that represent the dynamics of the system. ● An activity diagram is essentially a fancy flowchart. they show the flow of control from activity to activity in the system, – What activities can be done in parallel and – any alternate paths in the flow. ● Activity diagrams can be used to show the flow across use cases or they may be used to represent the flow within a particular use case

3 Introduction ● Activity diagrams and state chart diagrams are related. – Activity diagrams are a special type of state. – because activities are the state of doing something. – While a state chart diagram focuses attention on an object undergoing a process (or on a process as an object), – an activity diagram focuses on the flow of activities involved in a single process. – Activity diagram shows the how those activities depend on one another.. ● The diagrams describe the state of activities by showing the sequence of activities performed.

4 Contents of an activity diagram ● Activities represented as rectangles with rounded edges. ● Transitions between the activities, drawn as directed arrows, ● Decision points shown as diamonds, and ● Synchronisation bars represented with thick or vertical bars.

5 Activity ● An activity represents the perfomance of some behavior in the workflow Create curriculum Create catalogue Select course to teach

6 Flow Transitions ● Transitions are used to show the passing of the control from one activity to another. – Shows how the action states are related to another. ● They are triggered by the completion of the behavior in the originating activity. Create curriculum Create catalogue Select course to teach

7 Types of transitions ● There are two kinds – Control flow – Object flow

8 Control flow ● Indicates the order of action states – That is, once a source action state completes its processing, a target action state starts its processing. – For example, the project management system may have the following order of action states for the task of generating a report: 1. The Project Manager Enters Report Criteria action state occurs first, because the project manager must enter the report criteria before the system can generate a report. 2. The Project Management System Generates Report action state occurs next, because the project management system must generate the report before the printer can print the report. 3. The Printer Prints Report action state occurs last, once the report has been generated by the project management system.

9 Control flow Control-flow transitions are also known as default transitions or automatic transitions, because they are unlabeled and are immediately triggered after the source action state completes processing.

10 Object flow ● An object-flow transition indicates that an action state inputs or outputs an object. ● For example, the action states shown in the Figure (next slide) may have inputs and outputs as follows: ● Project Manager Enters Report Criteria – Outputs a Report Criteria object and may be renamed as the Project Manager – Enters Data action state ● Project Management System Generates Report – Inputs the Report Criteria object and outputs a Report object and may be renamed as the Project Management System Generates Information action state ● Printer Prints Report – Inputs the Report object and may be renamed as the Printer Prints Information action state

11 Object flows ● The advantage of using object flows is that action state names can now focus purely on the actions, while the object-flow transitions indicate clearly the inputs and outputs to and from the actions.

12 Transition flows ● A control-flow transition may be omitted when an object-flow transition indicates the ordering of action states; that is, – when an action state produces an output that is input to a subsequent action state, the object-flow transition implies a control-flow transition and an explicit control-flow transition is not necessary.

13 Decision points ● When modelling the workflow of a system it is often necessary to show where the flow of control branches based on decision points. ● The transitions from a decision point contain a guard condition, which is used to determine which path from the decision point is taken. ● Decisions along with their guard conditions allow you to show alternate paths through a workflow.

14 Decision points Create curriculum Assign professor to course Select course to teach Are all professors Assigned?

15 A transition with a guard Create curriculum Assign professor to course Select course to teach Are all professors Assigned? No

16 Decisions ● Notice that because the diamond shape is in the project manager’s swimlane, the project manager is responsible for making the decision.

17 Concurrency ● In a workflow some activities may be perfomed at the same time. ● A syncronisation bar allows you to specify which activities may be performed concurrently. – In the UML, concurrency is shown using a short heavy bar. – If a bar has one incoming transition and two or more outgoing transitions, it indicates that all outgoing transitions occur once the incoming transition occurs. This is called splitting of control. – If a bar has two or more incoming transitions and one outgoing transition, it indicates that all incoming transitions must occur before the outgoing transition occurs. This is called synchronization of control.

18 Syncronisation Bars Create curriculum Assign professor to course Select course to teach Are all professors Assigned? No Yes

19 Create catalogue Place catalogue in book store Mail catalogue To students Open registration Yes

20 Concurrency

21 Swimlanes ● Swimlanes may be used to partition an activity diagram. ● This is mainly done to show what person or organisation is repsonsible for the activities contained in the swimlane ● For example, the project management system may have the following swimlanes, which are illustrated in Figure below: ● Project Manager – Shows the action states that are the responsibility of a project manager. The swimlane makes it obvious that the project manager is responsible for entering data, thus the rather cumbersome action state name of Project Manager Enters – Data may be shortened to Enter Data.

22 Swimlanes ● Project Management System – Shows the action states that are the responsibility of the project management system. Again, because the swimlane makes it obvious who (or what, in this case) is generating information, the rather cumbersome action state name of Project Management System Generates Information may be shortened to Generate Information. ● Printer – Shows the action states that are the responsibility of a printer. Because of this swimlane, the rather cumbersome action state name of Printer Prints – Information may be shortened to Print Information.

23 Swimlanes Create curriculum Assign professor to course Select course to teach Are all professors Assigned? No Yes RegistraProfessor

24 Create catalogue Place catalogue in book store Mail catalogue To students Open registration Yes

25 Swimlanes example

26 Initial and final activities ● There are special symbols that are used to show the starting and final activities in a work flow ● The starting activity is shown using a solid filled circle and the final activities are shown using a bull’s eye. ● Typically there’s one starting activity for the work flow and there may be more than one ending activity (One for each alternate flow in the workflow).

27 Initial and final activities Create curriculum Assign professor to course Select course to teach Are all professors Assigned? No Yes

28 Create catalogue Place catalogue in book store Mail catalogue To students Open registration Yes

29 Diagrams used ● Initial node. The filled in circle is the starting point of the diagram. An initial node isn’t required although it does make it significantly easier to read the diagram. ● Activity final node. A filled circle (Bull eye) with a border is the ending point. An activity diagram can have zero or more activity final nodes. ● Activity. The rounded rectangles represent activities that occur. An activity may be physical, such as Inspect Forms, or electronic, such as Display Create Student Screen. ● Flow/edge. The arrows on the diagram.

30 Diagrams used ● Fork. A black bar with one flow going into it and several leaving it. This denotes the beginning of parallel activity. ● Join. A black bar with several flows entering it and one leaving it. This denotes the end of parallel processing. ● Condition. Text such as [No] on a flow, defining a guard which must evaluate to true in order to traverse the node. ● Decision. A diamond with one flow entering and several leaving. The flows leaving include conditions although some modelers will not indicate the conditions if it is obvious.

31 Diagrams used ● Merge. A diamond with several flows entering and one leaving. The implication is that all incoming flows must reach this point until processing continues, unless otherwise. ● Partition. Also called swimlanes, indicates who/what is performing the activities. ● Sub-activity indicator. The rake in the bottom corner of an activity, indicates that the activity is described by a more finely detailed activity diagram. ● Flow final. The circle with the X through it. This indicates that the process stops at this point. ● Signal: When an activity sends or receives a message, that activity is called a signal. – Signals are of two types: Input signal (Message receiving activity) shown by a concave polygon and Output signal (Message sending activity) shown by a convex polygon.

32 How to Draw: Activity Diagrams ● Activity diagrams show the flow of activities through the system. ● Diagrams are read from top to bottom and have branches and forks to describe conditions and parallel activities. – A fork is used when multiple activities are occurring at the same time. – The diagram below shows a fork after activity1. – This indicates that both activity2 and activity3 are occurring at the same time. – After activity2 there is a branch. – The branch describes what activities will take place based on a set of conditions. – All branches at some point are followed by a merge to indicate the end of the conditional behavior started by that branch. – After the merge all of the parallel activities must be combined by a join before transitioning into the final activity state.

33

34 Example ● Below is a possible activity diagram for processing an order. ● The diagram shows the flow of actions in the system's workflow. ● Once the order is received the activities split into two parallel sets of activities. – One side fills and sends the order while the other handles the billing. – On the Fill Order side, the method of delivery is decided conditionally. – Depending on the condition either the Overnight Delivery activity or the Regular Delivery activity is performed. – Finally the parallel activities combine to close the order.

35

36 When to Use: Activity Diagrams ● Activity diagrams should be used in conjunction with other modeling techniques such as interaction diagrams and state diagrams. ● The main reason to use activity diagrams is to model the workflow behind the system being designed. ● Activity Diagrams are also useful for: – analyzing a use case by describing what actions need to take place and when they should occur; – describing a complicated sequential algorithm; – and modeling applications with parallel processes. ● However, activity diagrams should not take the place of interaction diagrams and state diagrams. – Activity diagrams do not give detail about how objects behave or how objects collaborate.


Download ppt "Activity diagrams. Introduction ● Activity diagrams are a behavioural model that represent the dynamics of the system. ● An activity diagram is essentially."

Similar presentations


Ads by Google