Introduction to Activity Diagram
What is an activity diagram (Activity Diagram)
Activity diagram is another common tool used by UML to model the dynamic behavior of the system. It describes the sequence of activities and shows the flow of control from one activity to another. The activity diagram is in essence The above is a flow chart; the activity diagram focuses on the flow of control from one activity to another
Activity diagram elements
Action State (Action State) The
action state refers to an atomic, uninterruptible action, and after this action is completed, it will turn to another state by completing a transition
. The action state diagram in UML is represented by a smooth rounded rectangle
Characteristics of the action state
- The action state is atomic and cannot be broken down into smaller parts
- The action state is uninterruptible, once it starts to run, it cannot be interrupted, and it runs until the end
- The action state is an instantaneous behavior, and the processing time it occupies is extremely short, and sometimes it can even be ignored
- The action state can have an incoming transition, and the incoming transition can be an action flow or an object flow; the action state has at least one out transition, and this transition starts from the internal completion and has nothing to do with external events
- The action state is different from the state in the state diagram. It cannot have entry actions and exit actions, let alone internal transitions.
Activity State The
activity state is used to express the non-atomic operation of the state machine.
In UML, the icons of the activity state and the action state are the same, but the activity state can give information such as entry action and exit action in the icon
Characteristics of the active state
- Activity state can be decomposed into other sub-activities or action states
- The internal activities of the active state can be represented by another activity diagram
- Unlike the action state, the activity state can have entry actions and exit actions, or internal transitions.
- The action state is a special case of the active state. If an active state only includes one action, then it is an action state
Start point
end point
The end of the whole event
End of sub-process
Sub-activity status
Course selection activity diagram
Branch and merge
Branch: One input and multiple output
Merger: Multiple input
and one output Fork and merge.
Fork is used to divide the control flow into two or more concurrently running branches and
merge to synchronize these concurrent branches. In order to achieve the purpose of completing a transaction together
Swim lane
Object stream
- You can place the object in the activity diagram and use a dependency to connect it to the action state or the activity state such as creation, modification, or cancellation. This method of use of the object constitutes the object flow
- Object flow is the dependency between the action state or the activity state and the object, which means the action uses the object or the action’s influence on the object
- Can be understood as data flow
Example of activity diagram
Librarian Activity Diagram
System Administrator Activity Diagram
The difference between activity diagram and state diagram
Activity diagram focuses on the flow of control from one activity to another, and is a process driven by internal processing.
State diagram focuses on describing the flow from one state to another, mainly involving external events.
The difference between activity diagram and flowchart
The flow chart focuses on the description of the processing process. Its main control structure is sequence, branch and loop. There is a strict sequence and time relationship between each processing. The
activity diagram describes the rules followed by the sequence relationship of the object activities, and it focuses on the performance. It is the behavior of the system, not the process of the system. The
activity diagram can represent the situation of concurrent activities. The flowchart cannot