Statecharts
A formal method for modeling the behavior of complex systems, introduced by David Harel in 1987. It extends the finite state machine with mechanisms such as hierarchical states, orthogonal regions, history states, guard conditions and actions, effectively avoiding the state explosion problem that arises when modeling with flat FSMs.
Timeline (last 90 days)
Hierarchical states and orthogonal regions can reduce the number of times common behaviors are defined from the product level to the sum level, which is the core engineering value of statecharts relative to FSMs.
Statecharts were proposed by David Harel in 1987, and their core extensions include hierarchical states, orthogonal regions, history states, and guard conditions and actions.
The F-91W's mode switching is suitable for abstraction using hierarchical states, with the top level being time mode, alarm mode, stopwatch mode, and hourly time signal setting; the Mode button handles top-level transitions, the Adjust button handles entering and traversing editing substates, and the Light button is a global instantaneous action.
There is a discussion project on Hacker News that attempts to use statecharts to model the behavior logic of the Casio F-91W.
After using a statechart, you can write unit tests for each transition, asserting the next state and output given the current state and event, and state coverage can be measured directly.
Statecharts can be exported via tools as test scripts or visual diagrams, so that test cases and design documents share the same source of truth.
A hierarchical state machine (HSM) is an extension of the FSM, originating from the Statecharts theory proposed by David Harel in 1987 and later becoming the theoretical basis of UML state diagrams, and it allows a state to nest sub-state machines within it.
All Facts (7)
Hierarchical states and orthogonal regions can reduce the number of times common behaviors are defined from the product level to the sum level, which is the core engineering value of statecharts relative to FSMs.
50%UnverifiedStatecharts were proposed by David Harel in 1987, and their core extensions include hierarchical states, orthogonal regions, history states, and guard conditions and actions.
50%UnverifiedThe F-91W's mode switching is suitable for abstraction using hierarchical states, with the top level being time mode, alarm mode, stopwatch mode, and hourly time signal setting; the Mode button handles top-level transitions, the Adjust button handles entering and traversing editing substates, and the Light button is a global instantaneous action.
50%UnverifiedAfter using a statechart, you can write unit tests for each transition, asserting the next state and output given the current state and event, and state coverage can be measured directly.
50%UnverifiedStatecharts can be exported via tools as test scripts or visual diagrams, so that test cases and design documents share the same source of truth.
50%UnverifiedA hierarchical state machine (HSM) is an extension of the FSM, originating from the Statecharts theory proposed by David Harel in 1987 and later becoming the theoretical basis of UML state diagrams, and it allows a state to nest sub-state machines within it.
50%UnverifiedThere is a discussion project on Hacker News that attempts to use statecharts to model the behavior logic of the Casio F-91W.
50%