15th Chapter State Diagram
In describing finite state machines (FSM), UML provides a rich range of conformance.
15.1 Basic knowledge
is a simple state migration diagram (STD) that describes the FSM that controls the user's login to the system. Rounded Rectangle table state. Place the name of each state between the upper lattices. A specific action is placed between the lower panes, indicating what to do when entering or exiting the state.
The solid circle in the upper-left corner of the figure is called the initial pseudo state. The FSM starts from this pseudo state and shifts according to the rules of change.
15.1.1 Specific Events
An event/action pair is included between the lower panes of the state graph.
15.1.2 Hyper Status
When many states respond in the same way to some of the same events, it is very convenient to use a hyper state. Multiple single-state and hyper-state graphs for each:
They are equivalent.
You can override a hyper-state migration by displaying a migration that starts at the child State. As follows:
The relationship between a hyper state and a child state is actually not equivalent to an inheritance relationship.
Hyper States can have entry, exit, and specific events that are the same as regular states. As follows:
15.1.3 initial pseudo state and end pseudo state
15.2 using the FSM diagram
The diagram is useful for understanding the state machine aspects of the known subsystems of behavior. However, most systems that are suitable for FSM are unpredictable in their behavior. The behavior of these systems can occur and evolve over time. The diagram is not suitable for systems that change frequently.
Text is a very flexible means of coping with change. View the Status Migration table (STT) for the State Migration diagram (STD).
Metro Revolving Door STD
Subway Revolving Door STT
The text format is much more convenient for developers.
15.3 Conclusion
Finite state machine is a kind of powerful software organization thought. UML provides rich compliance support for FSM visualization. However, in terms of developing and maintaining an FSM, it is often easier to adopt a text language than a graphic. UML states conform to many, but I seldom find them useful.
Excerpt from: "Agile Software Development: principles, patterns and Practices (C # Edition)" Robert C.martin Micah Martin
Reprint please specify the source:
Jesselzj
Source: http://jesselzj.cnblogs.com
Agile Software Development: principles, patterns and practices--the 15th Chapter state diagram