Activity Diagram Element Toolbox Icons
Activity diagrams are used to model system behaviors, and the way in whichthese behaviors are related in an overall flow of the system (that is, dynamicelement interactions). The logical paths a process follows, based on variousconditions, concurrent processing, data access, interruptions and otherlogical path distinctions, are all used to construct a process, system orprocedure.You generate Activity diagram elements and connectors from the ‘Activity’pages of the Diagram Toolbox.
Activity Diagram Element Toolbox Icons
| | —|—|— |An Activity element organizes and specifies the participation of subordinatebehaviors, such as sub-Activities or Actions, to reflect the control and dataflow of a process.| Activity |A Structured Activity is an activity node that can have subordinate nodes asan independent Activity Group.| Structured Activity |An Action element describes a basic process or transformation that occurswithin a system, and is the basic functional unit within an Activity diagram.| Action |A Partition element is used to logically organize an Activity’s elements.| Partition |An Object is a particular instance of a Class at run time.| Object |A Central Buffer Node is an object node for managing flows from multiplesources and destinations, represented in an Activity diagram.| Central Buffer Node |A Datastore defines permanently stored data.| Datastore |In an Activity diagram or Interaction Overview diagram, a Decision indicates apoint of conditional progression: if a condition is True, then processingcontinues one way; if not, then another.| Decision |A Merge Node brings together a number of alternative flow paths in Activity,Analysis and Interaction Overview diagrams.| Merge |The Send element depicts the action of sending a signal, in an Activitydiagram.| Send |A Receive element defines the acceptance or receipt of a request, in anActivity diagram.| Receive |A Synch state is useful for indicating that concurrent paths of a StateMachineare synchronized. It is used to split and rejoin periods of parallelprocessing.| Synch |An Initial element is used to define the start of a flow when an Activity isinvoked.| Initial |The Activity Final element indicates the completion of an Activity; uponreaching the Final, all execution in the Activity diagram is aborted.| Final |The Flow Final element depicts an exit from the system, as opposed to theActivity Final, which represents the completion of the Activity.| Flow Final |Enterprise Architect supports two types of Region element: Expansion Regionsand Interruptible Activity Regions.An Expansion Region surrounds a process to be imposed multiple times on theincoming data, once for every element in the input collection.An Interruptible Activity Region surrounds a group of Activity elements, allaffected by certain interrupts in such a way that all tokens passing withinthe region are terminated should the interruption(s) be raised.| Region |The Exception Handler element defines the group of operations to carry outwhen an exception occurs.| Exception |A Fork/Join element can be used to:1) Split a single flow into a number of concurrent flows2) Join a number of concurrent flows or3) Both join and fork a number of incoming flows to a number of outgoing flows| Fork/Join Fork Join |A Fork/Join element can be used to:1) Split a single flow into a number of concurrent flows2) Join a number of concurrent flows or3) Both join and fork a number of incoming flows to a number of outgoing flows| Join Fork/Join Fork
Activity Diagram Connector Toolbox Icons
| | —|—|— |The Control Flow connects two nodes in an Activity diagram, modeling an activetransition.| Control Flow |An Object Flow connects two elements, with specific data passing through it,modeling an active transition.| Object Flow |The Interrupt Flow defines the two UML concepts of connectors for ExceptionHandler and Interruptible Activity Region.| Interrupt Flow
UML – Activity Diagrams
* * *Activity diagram is another important diagram in UML to describe the dynamicaspects of the system.Activity diagram is basically a flowchart to represent the flow from oneactivity to another activity. The activity can be described as an operation ofthe system.The control flow is drawn from one operation to another. This flow can besequential, branched, or concurrent. Activity diagrams deal with all type offlow control by using different elements such as fork, join, etc
How to Draw an Activity Diagram?
Activity diagrams are mainly used as a flowchart that consists of activitiesperformed by the system. Activity diagrams are not exactly flowcharts as theyhave some additional capabilities. These additional capabilities includebranching, parallel flow, swimlane, etc.Before drawing an activity diagram, we must have a clear understanding aboutthe elements used in activity diagram. The main element of an activity diagramis the activity itself. An activity is a function performed by the system.After identifying the activities, we need to understand how they areassociated with constraints and conditions.Before drawing an activity diagram, we should identify the following elements− * Activities * Association * Conditions * ConstraintsOnce the above-mentioned parameters are identified, we need to make a mentallayout of the entire flow. This mental layout is then transformed into anactivity diagram.Following is an example of an activity diagram for order management system. Inthe diagram, four activities are identified which are associated withconditions. One important point should be clearly understood that an activitydiagram cannot be exactly matched with the code. The activity diagram is madeto understand the flow of activities and is mainly used by the business usersFollowing diagram is drawn with the four main activities −After receiving the order request, condition checks are performed to check ifit is normal or special order. After the type of order is identified, dispatchactivity is performed and that is marked as the termination of the process.
Where to Use Activity Diagrams?
The basic usage of activity diagram is similar to other four UML diagrams. Thespecific usage is to model the control flow from one activity to another. Thiscontrol flow does not include messages.Activity diagram is suitable for modeling the activity flow of the system. Anapplication can have multiple systems. Activity diagram also captures thesesystems and describes the flow from one system to another. This specific usageis not available in other diagrams. These systems can be database, externalqueues, or any other system.We will now look into the practical applications of the activity diagram. Fromthe above discussion, it is clear that an activity diagram is drawn from avery high level. So it gives high level view of a system. This high level viewis mainly for business users or any other person who is not a technicalperson.This diagram is used to model the activities which are nothing but businessrequirements. The diagram has more impact on business understanding ratherthan on implementation details.Activity diagram can be used for − * Modeling work flow by using activities. * Modeling business requirements. * High level understanding of the system’s functionalities. * Investigating business requirements at a later stage.UML Activity Diagram
Components of an Activity Diagram
Following are the component of an activity diagram:ActivitiesThe categorization of behavior into one or more actions is termed as anactivity. In other words, it can be said that an activity is a network ofnodes that are connected by edges. The edges depict the flow of execution. Itmay contain action nodes, control nodes, or object nodes.The control flow of activity is represented by control nodes and object nodesthat illustrates the objects used within an activity. The activities areinitiated at the initial node and are terminated at the final node.Activity partition /swimlaneThe swimlane is used to cluster all the related activities in one column orone row. It can be either vertical or horizontal. It used to add modularity tothe activity diagram. It is not necessary to incorporate swimlane in theactivity diagram. But it is used to add more transparency to the activitydiagram.ForksForks and join nodes generate the concurrent flow inside the activity. A forknode consists of one inward edge and several outward edges. It is the same asthat of various decision parameters. Whenever a data is received at an inwardedge, it gets copied and split crossways various outward edges. It split asingle inward flow into multiple parallel flows.Join NodesJoin nodes are the opposite of fork nodes. A Logical AND operation isperformed on all of the inward edges as it synchronizes the flow of inputacross one single output (outward) edge.PinsIt is a small rectangle, which is attached to the action rectangle. It clearsout all the messy and complicated thing to manage the execution flow ofactivities. It is an object node that precisely represents one input to oroutput from the action.
Notation of an Activity diagram
Activity diagram constitutes following notations:Initial State: It depicts the initial stage or beginning of the set ofactions.Final State: It is the stage where all the control flows and object flows end.Decision Box: It makes sure that the control flow or object flow will followonly one path.Action Box: It represents the set of actions that are to be performed.
How to draw an Activity Diagram?
An activity diagram is a flowchart of activities, as it represents theworkflow among various activities. They are identical to the flowcharts, butthey themself are not exactly the flowchart. In other words, it can be saidthat an activity diagram is an enhancement of the flowchart, which encompassesseveral unique skills.Since it incorporates swimlanes, branching, parallel flows, join nodes,control nodes, and forks, it supports exception handling. A system must beexplored as a whole before drawing an activity diagram to provide a clearerview of the user. All of the activities are explored after they are properlyanalyzed for finding out the constraints applied to the activities. Each andevery activity, condition, and association must be recognized.After gathering all the essential information, an abstract or a prototype isbuilt, which is then transformed into the actual diagram.Following are the rules that are to be followed for drawing an activitydiagram: 1. A meaningful name should be given to each and every activity. 2. Identify all of the constraints. 3. Acknowledge the activity associations.
Example of an Activity Diagram
An example of an activity diagram showing the business flow activity of orderprocessing is given below.Here the input parameter is the Requested order, and once the order isaccepted, all of the required information is then filled, payment is alsoaccepted, and then the order is shipped. It permits order shipment before aninvoice is sent or payment is completed.
When to use an Activity Diagram?
An activity diagram can be used to portray business processes and workflows.Also, it used for modeling business as well as the software. An activitydiagram is utilized for the followings: 1. To graphically model the workflow in an easier and understandable way. 2. To model the execution flow among several activities. 3. To model comprehensive information of a function or an algorithm employed within the system. 4. To model the business process and its workflow. 5. To envision the dynamic aspect of a system. 6. To generate the top-level flowcharts for representing the workflow of an application. 7. To represent a high-level view of a distributed or an object-oriented system.* * * Unified Modeling Language (UML) | Activity DiagramsWe use Activity Diagrams to illustrate the flow of control in a system andrefer to the steps involved in the execution of a use case. We modelsequential and concurrent activities using activity diagrams. So, we basicallydepict workflows visually using an activity diagram. An activity diagramfocuses on condition of flow and the sequence in which it happens. We describeor depict what causes a particular event using an activity diagram.UML models basically three types of diagrams, namely, structure diagrams,interaction diagrams, and behavior diagrams. An activity diagram is abehavioral diagram i.e. it depicts the behavior of a system.An activity diagram portrays the control flow from a start point to a finishpoint showing the various decision paths that exist while the activity isbeing executed. We can depict both sequential processing and concurrentprocessing of activities using an activity diagram. They are used in businessand process modelling where their primary use is to depict the dynamic aspectsof a system.An activity diagram is very similar to a flowchart. So let us understand if anactivity diagrams or a flowcharts are any different :
Difference between an Activity diagram and a Flowchart –
Flowcharts were typically invented earlier than activity diagrams. Nonprogrammers use Flow charts to model workflows. For example: A manufactureruses a flow chart to explain and illustrate how a particular product ismanufactured. We can call a flowchart a primitive version of an activitydiagram. Business processes where decision making is involved is expressedusing a flow chart.So, programmers use activity diagrams (advanced version of a flowchart) todepict workflows. An activity diagram is used by developers to understand theflow of programs on a high level. It also enables them to figure outconstraints and conditions that cause particular events. A flow chartconverges into being an activity diagram if complex decisions are being made.Brevity is the soul of wit. We need to convey a lot of information withclarity and make sure it is short. So an activity diagram helps people on bothsides i.e. Businessmen and Developers to interact and understand systems.A question arises:Do we need to use both the diagram and the textual documentation? Different individuals have different preferences in which they understandsomething. For example: To understand a concept, some people might prefer awritten tutorial with images while others would prefer a video lecture. So we generally use both the diagram and the textual documentation to make oursystem description as clear as possible. We also need to be sensitive to theneeds of the audience that we are catering to at times.Difference between a Use case diagram and an Activity diagramAn activity diagram is used to model the workflow depicting conditions,constraints, sequential and concurrent activities. On the other hand, thepurpose of a Use Case is to just depict the functionality i.e. what the systemdoes and not how it is done. So in simple terms, an activity diagram shows‘How’ while a Use case shows ‘What’ for a particular system. The levels of abstraction also vary for both of them. An activity diagram canbe used to illustrate a business process (high level implementation) to astand alone algorithm (ground level implementation). However, Use cases have alow level of abstraction. They are used to show a high level of implementationonly. Figure – an activity diagram for an emotion based music playerThe above figure depicts an activity diagram for an emotion based music playerwhich can also be used to change the wallpaper.The various components used in the diagram and the standard notations areexplained below.
Activity Diagram Notations –
1. Initial State – The starting state before an activity takes place is depicted using the initial state. Figure – notation for initial state or start stateA process can have only one initial state unless we are depicting nestedactivities. We use a black filled circle to depict the initial state of asystem. For objects, this is the state when they are instantiated. The InitialState from the UML Activity Diagram marks the entry point and the initialActivity State.For example – Here the initial state is the state of the system before theapplication is opened. Figure – initial state symbol being used 2. Action or Activity State – An activity represents execution of an action on objects or by objects. We represent an activity using a rectangle with rounded corners. Basically any action or event that takes place is represented using an activity. Figure – notation for an activity stateFor example – Consider the previous example of opening an application openingthe application is an activity state in the activity diagram. Figure – activity state symbol being used 3. Action Flow or Control flows – Action flows or Control flows are also referred to as paths and edges. They are used to show the transition from one activity state to another. Figure – notation for control FlowAn activity state can have multiple incoming and outgoing action flows. We usea line with an arrow head to depict a Control Flow. If there is a constraintto be adhered to while making the transition it is mentioned on the arrow.Consider the example – Here both the states transit into one final state usingaction flow symbols i.e. arrows. Figure – using action flows for transitions 4. Decision node and Branching – When we need to make a decision before deciding the flow of control, we use the decision node. Figure – notation for decision nodeThe outgoing arrows from the decision node can be labelled with conditions orguard expressions.It always includes two or more output arrows. Figure – an activity diagram using decision node 5. Guards – A Guard refers to a statement written next to a decision node on an arrow sometimes within square brackets. Figure – guards being used next to a decision nodeThe statement must be true for the control to shift along a particulardirection. Guards help us know the constraints and conditions which determinethe flow of a process. 6. Fork – Fork nodes are used to support concurrent activities. Figure – fork notationWhen we use a fork node when both the activities get executed concurrentlyi.e. no decision is made before splitting the activity into two parts. Bothparts need to be executed in case of a fork statement. We use a rounded solid rectangular bar to represent a Fork notation withincoming arrow from the parent activity state and outgoing arrows towards thenewly created activities. For example: In the example below, the activity of making coffee can be splitinto two concurrent activities and hence we use the fork notation. Figure – a diagram using fork 7. Join – Join nodes are used to support concurrent activities converging into one. For join notations we have two or more incoming edges and one outgoing edge. Figure – join notationFor example – When both activities i.e. steaming the milk and adding coffeeget completed, we converge them into one final activity. Figure – a diagram using join notation 8. Merge or Merge Event – Scenarios arise when activities which are not being executed concurrently have to be merged. We use the merge notation for such scenarios. We can merge two or more activities into one if the control proceeds onto the next activity irrespective of the path chosen. Figure – merge notationFor example – In the diagram below: we can’t have both sides executingconcurrently, but they finally merge into one. A number can’t be both odd andeven at the same time. Figure – an activity diagram using merge notation 9. Swimlanes – We use swimlanes for grouping related activities in one column. Swimlanes group related activities into one column or one row. Swimlanes can be vertical and horizontal. Swimlanes are used to add modularity to the activity diagram. It is not mandatory to use swimlanes. They usually give more clarity to the activity diagram. It’s similar to creating a function in a program. It’s not mandatory to do so, but, it is a recommended practice. Figure – swimlanes notation We use a rectangular column to represent a swimlane as shown in the figureabove.For example – Here different set of activities are executed based on if thenumber is odd or even. These activities are grouped into a swimlane. Figure – an activity diagram making use of swimlanes 10. Time Event – Figure – time event notationWe can have a scenario where an event takes some time to complete. We use anhourglass to represent a time event. For example – Let us assume that the processing of an image takes takes a lotof time. Then it can be represented as shown below. Figure – an activity diagram using time event 11. Final State or End State – The state which the system reaches when a particular process or activity ends is known as a Final State or End State. We use a filled circle within a circle notation to represent the final state in a state machine diagram. A system or a process can have multiple final states. Figure – notation for final state
How to Draw an activity diagram –
1. Identify the initial state and the final states. 2. Identify the intermediate activities needed to reach the final state from he initial state. 3. Identify the conditions or constraints which cause the system to change control flow. 4. Draw the diagram with appropriate notations. Figure – an activity diagramThe above diagram prints the number if it is odd otherwise it subtracts onefrom the number and displays it.