Skip Navigation Links > Modeling > UML > Activity

Activity diagram


An activity diagram is essentially a fancy flowchart. Activity diagrams and state machine diagrams are related. While a state machine diagram focuses attention on an object undergoing a process, an activity diagram focuses on the flow of activities involved in a single process and shows how these activities depend on one another.

Each activity represents a unit of work carried out by an object. The abstraction level of this object could be a system, a layer, a sub-system, a class category (a component), or an individual class. The object to which an activity is mapped can be assigned to a swim lane (activity partition). Each activity in a swim lane performs its job before passing control to the next activity in the flow. If too many activities are assigned for example, to a single component then that component could cause performance or reliability problems. An activity diagram is therefore very useful for load balancing. Hotspots can be identified at runtime with profiling tools, however it is much more efficient to catch these kinds of problems at design time.

An activity is often a design artifact belonging the business domain. Hence, activity diagrams are primarily used for modeling the dynamics of business and system processes.

Since activity diagrams emphasize the flow of control from activity to activity they can be used to describe a use-case scenario. Sequence diagrams on the other hand emphasize the flow of control from object to object and are best suited to validate a use-case scenario as being executable. In either case it should be apparent that the use-case model represents the requirements and drives the architecture and is therefore an essential project artifact. Always check the use-case model with the customer (i.e. get it signed off) at the beginning of each new release iteration.

For our example, we used the following process:

"Withdraw money from a bank account through an ATM."

The three objects involved in the activity diagram are Customer, ATM, and Bank. The process begins at the black start circle at the top and ends at the concentric white/black stop circles at the bottom. The activities are the rounded rectangles. Each one is assigned into a specific swim lane. A single transition comes out of each activity connecting it to the next activity.

Activity diagram

A transition may branch into two or more mutually exclusive transitions. Guard expressions (inside [ ]) label the transitions coming out of a branch. A branch and its subsequent merge marking the end of the branch appear in the diagram as hollow diamonds. A transition may fork into two or more parallel activities. The fork and the subsequent join of the threads coming out of the fork appear in the diagram as solid bars.

 
Self test

Top-of-page | Use-Case | Class | Package | Sequence | Communication | State | Activity | Deployment