Activity Diagram Examples and Tutorial

Activity diagrams are an essential part of the Unified Modeling Language (UML) suite, used to depict the dynamic aspects of a system. They visualize the flow of control and data among different activities, enabling analysts and developers to understand and communicate complex system functionalities effectively.

Activity Diagram Tutorial: Definition, Symbols, Examples, and How to Draw One | Creately
Activity Diagram Tutorial: Definition, Symbols, Examples, and How to Draw One | Creately

A well-crafted activity diagram can serve as a blueprint for software development, guiding teams through the intricacies of a system's workflow. It's not only beneficial for software engineers but also for business analysts, testers, and stakeholders, aiding them in comprehending the system's behavior at a high level.

an activity diagram with instructions to use
an activity diagram with instructions to use

Understanding Activity Diagrams

Activity diagrams are process flow diagrams that illustrate the flow of control among activities using a combination of nodes and connected arrows. They represent the dynamic view of a system, complementing the static views provided by class and component diagrams.

Activity Diagram, UML Diagrams Example: Swimlane - Visual Paradigm Community Circle
Activity Diagram, UML Diagrams Example: Swimlane - Visual Paradigm Community Circle

At their core, activity diagrams consist of the following elements:

  • Activities - Represents a significant piece of work in the system.
  • Actions - Perform an operation that produces output or has side effects.
  • Control Flows - Directed edges that represent the flow of control between activities.
  • Objects - Represents entities in the system.
  • Pins - Connects the object to the activity.
a flow diagram with several different types of items in each area and the following steps
a flow diagram with several different types of items in each area and the following steps

Activity Nodes

Activity nodes represent the different types of activities in a diagram. They are categorized into four main types:

  • Action - A single, atomic operation that has a predefined input and output.
  • Activity - Represents a process that consists of multiple actions or activities.
  • Fork - Splits the control flow into multiple parallel paths.
  • Join - Waits for multiple flows to synchronize.
an activity diagram for children to play in the park, and learn how to use it
an activity diagram for children to play in the park, and learn how to use it

Each node type has specific symbols and connecting logic, which when combined, illustrate the dynamic behavior of the system.

Control Flow

Control flows, represented by solid arrows, link activities and provide the sequence of actions. They can have multiple incoming and outgoing edges, illustrating complex decision points and merge points.

Activity Diagram for Airline Reservation System
Activity Diagram for Airline Reservation System

Control flows can exhibit different types of behavior, such as:

  • Sequential - Activities occur one after another.
  • Conditional - Activities might or might not occur based on a condition.
  • Concurrent - Activities occur simultaneously.
Activity Network Diagram: Mastering Project Management - SixSigma.us
Activity Network Diagram: Mastering Project Management - SixSigma.us
the symbols for different types of electrical devices are shown in black and white, with arrows pointing
the symbols for different types of electrical devices are shown in black and white, with arrows pointing
ATM (Activity Diagram)
ATM (Activity Diagram)
Activity Network Diagram
Activity Network Diagram
Activity Diagram for Login | Creately
Activity Diagram for Login | Creately
a flow diagram with different types of items in the process, including an object that appears to
a flow diagram with different types of items in the process, including an object that appears to
an activity diagram for admin side
an activity diagram for admin side

The combination of activity nodes and control flows allows complex workflows to be modeled and understood.

Activity Diagram with an Example

Let's consider a simple online ordering system for a restaurant to illustrate an activity diagram. This system allows customers to browse the menu, place an order, and make a payment.

Here's a basic activity diagram for this system:

Activities Control Flows
Browse Menu =>
Place Order <-
Select Payment Method =>
Make Payment <-
Order Confirmation =>

The diagram begins with the customer browsing the menu, followed by placing an order. After that, the customer selects a payment method and makes a payment. Finally, the order is confirmed, and the workflow ends.

Decision Points and Merge Points

Activity diagrams can also model complex decision-making processes and concurrent activities. A fork node splits the control flow into multiple parallel paths, while a join node waits for multiple flows to synchronize.

For example, if the online ordering system allows customers to choose between delivery and pickup, the diagram would branch at the 'Place Order' activity. One path would lead to 'Prepare for Delivery,' and the other to 'Prepare for Pickup.' Both paths would merge at a 'Wait for Collection' activity, which represents the end of the order process.

Activity diagrams provide a powerful visual tool for modeling and communicating complex workflows. They are integral to analyzing and understanding system behavior, guiding software development, and facilitating effective communication among all stakeholders.

Eager to learn more about activity diagrams? Explore our comprehensive guide on UML activity diagram syntax and best practices. Ready to model your own complex systems? Try our intuitive UML tool today and bring your ideas to life!