The document discusses Activity Diagrams in UML, which represent the dynamic aspects of a system through flow charts that illustrate the flow between activities. It covers the components of activity diagrams including activities, actions, transitions, and the use of swimlanes to organize activities by actors or classes. Additionally, it provides guidelines for constructing activity diagrams and examples related to order management and banking processes.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
4 views29 pages
Lec 19
The document discusses Activity Diagrams in UML, which represent the dynamic aspects of a system through flow charts that illustrate the flow between activities. It covers the components of activity diagrams including activities, actions, transitions, and the use of swimlanes to organize activities by actors or classes. Additionally, it provides guidelines for constructing activity diagrams and examples related to order management and banking processes.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 29
Object Oriented Analysis & Design
Lecture 19 : Activity Diagram
Dinesh Kumar Bhawnani
BIT DURG Activity Diagram • Activity diagram is another important diagram in UML to describe dynamic aspects of the system. • Activity diagram is basically a flow chart to represent the flow form one activity to another activity. • The activity can be described as an operation of the system. So the control flow is drawn from one operation to another. • This flow can be sequential, branched or concurrent. • Activity diagrams deals with all type of flow control by using different elements like fork, join etc.
Dinesh Kumar Bhawnani, BIT DURG
Activity Diagram • Activity Diagrams describe – 1. how activities are coordinated to provide a service 2. the service can be at different levels of abstraction 3. the events needed to achieve some operation, particularly where the operation is intended to achieve a number of different things that require coordination 4. how the events in a single use case relate to one another 5. in particular, use cases where activities may overlap and require coordination 6. how a collection of use cases coordinate to create a workflow for an organization Dinesh Kumar Bhawnani, BIT DURG Activity Diagram (Usage) 1. Model business workflows 2. Identify candidate use cases, through the examination of business workflows 3. Identify pre- and post-conditions for use cases 4. Model workflows between/within use cases 5. Model complex workflows in operations on objects 6. Model in detail complex activities in a high level activity diagram
Dinesh Kumar Bhawnani, BIT DURG
Activities • An Activity is the process being modelled • Activities are the vertices of the diagram • An Activity is a unit of work that needs to be carried out • Any Activity takes time • An activity is like a state where the criterion for leaving the state is the completion of the activity
Dinesh Kumar Bhawnani, BIT DURG
Actions • An Action is a step in the overall activity • The work can be documented as Actions in the activity • There are four ways in which an action can be triggered 1. On Entry – as soon as the activity starts 2. Do – during lifetime of the activity 3. On Event – in response to an event 4. On Exit – just before the activity completes
Dinesh Kumar Bhawnani, BIT DURG
Transitions • A Transition is the movement from one activity to another, the change from one state to another, or the movement between a state and an activity in either direction • Transitions: unlabeled arrows from one activity to the next • Transitions take place when one activity is complete and the next can commence
Dinesh Kumar Bhawnani, BIT DURG
Activity Edges • The flow of an activity is shown using arrowed lines called edges or paths • Control-flow Transitions indicate the order of action states • Object-flow Transitions indicate that an action state inputs or outputs an object • Time could be a factor in an activity • Time events are drawn with an hourglass symbol
Dinesh Kumar Bhawnani, BIT DURG
Token • Conceptually, UML models information moving along an edge as a token (e.g., real data, an object or focus of control) • Each edge may have 1. a weight associated with it that indicates how many tokens must be available before the tokens are presented to the target action 2. a guard condition
Dinesh Kumar Bhawnani, BIT DURG
Activity Nodes • UML 2.0 defines several types of activity nodes to model different types of information flow 1. Parameters nodes 2. Object nodes 3. (input or output) Pins - special notation for object nodes; exception pins, value pins
Dinesh Kumar Bhawnani, BIT DURG
Initial and Final Nodes • An initial node is the starting point for an activity • Two types of final nodes: activity final and flow final • An activity final node terminates the entire activity • A flow final node terminates a path through an activity, but not the entire activity • It is possible to have multiple initial nodes and final nodes Dinesh Kumar Bhawnani, BIT DURG Initial and Final Nodes • Warnings: be careful when using a flow final node after a fork. As soon as the activity final node is reached, all other actions in the activity (including the ones before the final flow node) terminate. If you want all forked actions to finish, make sure to add a join.
Dinesh Kumar Bhawnani, BIT DURG
Fork • A transition can be split into multiple paths and multiple paths combined into a single transitions by using a synchronization bar. • A synchronization may have many in-arcs from activities and a number of out-arcs to activities. • A fork is where the paths split. • On an occurrence of the transition all the activities with arcs from the transition are initiated. • A fork node splits the current flow through an activity into multiple concurrent flows. • In a detailed design model, you can use forks to represent multiple processes or multiple threads in a program. Dinesh Kumar Bhawnani, BIT DURG Join • A join is where the paths meet. • The bar represents synchronization of the completion of those activities with arcs into the transition. •A join synchronizes multiple flows of an activity back to a single flow of execution. Dinesh Kumar Bhawnani, BIT DURG Decision and Merge Points • A decision point shows where the exit transition from a state or activity may branch in alternative directions depending on a condition. • A decision involves selecting one control-flow transition out of many control flow transitions based on a condition. • Each branched edge contains a guard condition. • Guard expressions (inside []) label the transitions coming out of a branch. • A merge point brings together alternate flows into a single output flow - note that it does not synchronize multiple concurrent flows.
Dinesh Kumar Bhawnani, BIT DURG
States • A state in an activity diagram is a point where some event needs to take place before activity can continue • Activities and States are similar 1. States carry out actions as activities do 2. Activities need to complete their actions before exiting 3. States are used to imply waiting, not doing • It is possible to show an object changing states as it flows through an activity
Dinesh Kumar Bhawnani, BIT DURG
Start and End States • The Start state is the entry point to a flow • There can be several End states – multiple End states can be used to indicate different follow-on processes from a particular process • Start and End states can have actions too • Malformed diagrams – it is possible to form ill-formed diagrams that require multiple activations of activities or can allow deadlock.
Dinesh Kumar Bhawnani, BIT DURG
Swimlanes • Swimlanes (or activity partitions) indicate where activities take place. • Swimlanes can also be used to identify areas at the technology level where activities are carried out. • Swimlanes allow the partition an activity diagram so that parts of it appear in the swimlane relevant to that element in the partition.
Dinesh Kumar Bhawnani, BIT DURG
Swimlanes • Partitions may be constructed on the basis of: 1. the class and actor doing the activity 2. Partitioning by class and actor can help to identify new associations that have not been documented in the class model 3. the use case the activity belongs to 4. Partitioning by use cases can help document how use cases interact
Dinesh Kumar Bhawnani, BIT DURG
Swimlanes
Dinesh Kumar Bhawnani, BIT DURG
Sending and Receiving Signals • In activity diagrams, signals represent interactions with external participants • Signals are messages that can be sent or received • A receive signal has the effect of waking up an action in your activity diagram • Send signals are signals sent to external participants. • Note that combining send and receive signals results in behavior similar to synchronous call, or a call that waits for a response. • It is common to combine send and receive signals in activity diagrams, because you often need a response to the signal you sent. Dinesh Kumar Bhawnani, BIT DURG Sending and Receiving Signals
Dinesh Kumar Bhawnani, BIT DURG
Sending and Receiving Signals
Dinesh Kumar Bhawnani, BIT DURG
How to construct Activity Diagrams? 1. Finding system Actors, Classes and use cases 2. Identifying key scenarios of system use cases 3. Combining the scenarios to produce comprehensive workflows described using activity diagrams 4. Where significant object behavior is triggered by a workflow, adding object flows to the diagrams 5. Where workflows cross technology boundaries, using swimlanes to map the activities 6. Refining complicated high level activities similarly, nested activity diagrams Dinesh Kumar Bhawnani, BIT DURG Activity Diagrams Example Draw an activity diagram for order management system. There are 4 activity which can be described as 1. Send order by the customer 2. Receipt of the order 3. Confirm order 4. Dispatch order After receiving the order request condition checks are performed to check if it is normal or special order. After the type of order is identified dispatch activity is performed and that is marked as the termination of the process.
Dinesh Kumar Bhawnani, BIT DURG
Activity Diagrams Example
Dinesh Kumar Bhawnani, BIT DURG
Activity Diagrams Example Draw an activity diagram for a use case “Withdraw money from a bank account through an ATM”.
Dinesh Kumar Bhawnani, BIT DURG
Activity Diagrams Example Draw an activity diagram for a “Parcel Shipping” Process.
Dinesh Kumar Bhawnani, BIT DURG
For Video lecture on this topic please subscribe to my youtube channel.