Also, a state diagram is one of the behavior diagrams that describes all possible states of a particular object and the transitions between states due to the occurrence of various events.
Relative to the activity diagram, the diagram of the state diagram is less, mainly: state, transfer, starting point and end point.
Speaking of state diagram, we have to say a state machine, state machine is what it. A state machine is a behavior that describes a sequence of states that an object or an interaction undergoes in response to an event during its lifetime. The behavior of collaboration between a single class or a group of classes can be described in a state machine. A state machine involves some other elements, including states, transitions (streams from one state to another state), and events (conditions that trigger transitions).
So how does the state define it. A state is a condition or condition that satisfies certain conditions, performs certain activities, or waits for certain events during the life of an object. Usually a state consists of the following parts:
1. Name
2. Introduction of collaboration and exit actions entry Action/exit action
3. Internal conversion internaltransition
4. Sub-State substate
5. Deferred event Deferredevent
It is important to note that the initial state and the terminating state are two special states. It is different from the normal state, it may not be the internal conversion, the introduction of collaboration and other parts.
Let's look at the concepts and contents of transformations: The so-called transformation is a relationship between two states, which indicates that the object will perform a certain action in the first State and enter the second state when a particular event occurs and a particular condition is satisfied. Usually a conversion consists of 5 parts:
1 Source Status Sourcestate
2 Event Trigger EventTrigger
3 Condition of guardianship guardcondition
Action Action 4
5 Target Status Targetstate
Finally, a small summary of the state diagram and the activity diagram: The state diagram focuses on describing the process from the result of the behavior, and the activity diagram is focused on describing the action from the behavior, and in the actual project, the activity diagram is not required. You need to use the activity diagram in the following situations:
Describe a parallel process or behavior
Describe an algorithm
Describe an activity that spans multiple use cases
Knowing the basics of activity diagrams, let me give you an example of an activity diagram so that you know how the activity diagram should be drawn:
First, give a very classic example, the transition diagram of the process state in the operating system
Of course, the above example is not the full meaning of the state diagram, you may find that it has no initial state and termination status, the following gives a computer room charge System State diagram example: