What is an Activity Diagram?
- Activity Diagram is on of the UML diagrams for modeling the dynamic aspects of the system.
- Activity diagram is drawn only from the system perspective.
- It is type of flow chat where the flow of control is from one activity to the other.
- An Activity is the function performed by the system.
- Activity diagram is not only important for modeling the dynamic aspect of a system but also for constructing executable systems.
Steps to draw an activity diagram
Step 1: Identify the base activity.
Step 2: Identify the actives before the base activity.
Step 3:identify the actives after the base activity.
Step 4:Identify conditions.
Step 5: identify Events(Time schedule)
Activity Diagram will have the following elements:
- Start Node:
Represent the initiation of a process, that is where the workflow begins
- Final Node:
Represents the completion of a process.
Represent the activity.
- Control Flow:
Represent the direction flow of the process.
- Fork & Join:
This is used for parallel activities. A fork indicated the point after which a number of actives may begging in any order. A join indicated that the workflow may commence only once the parallel actives that flow into it have all been completed.
- Guard Condition:
It is a condition attached to the control flow, when the guard condition is true workflow may flow along the control flow. It is show within square brackets.
It has at least 2 paths coming out of the decision node which tells you which direction to move forward based on the guard condition.
- Branch & Merge:
Branching :Opted when you want one sequence to be divided into several alternatives. For example Mode of payment while placing an order in an E-commerce website: Debit Card, Internet Banking, Wallet.
Merging: Opted when several flows lead to the same activity. For example After the payment is done among one of the mode of payment, all leads to the successful completion of a payment and proceeds with placement of an order in an E-commerce application.
A trigger attached to a control flow An event must occur for the flow to move along the control flow.
Thing to remember while drawing an activity diagram
- All the activities should be from system perspective.
- Actives are time bounded.
- Number of flows that enter during fork should be equal to the number of flows leaving at the time of join.
- All the possible conditions must be included without fail.