I am studying for an exam and a question on one of the previous exams is:
A lot of answers on the web are saying Statecharts and Statemachines are the same thing? If not could someone explain the difference in relation to this question.
If someone could give examples of both it would really help. Thanks
Statechart diagram is used to describe the states of different objects in its life cycle. Emphasis is placed on the state changes upon some internal or external events. These states of objects are important to analyze and implement them accurately. Statechart diagrams are very important for describing the states.
Statechart diagrams are used to describe the various state that an object passes through. A transition between one state into another state occurs because of some triggered event. To draw a state diagram in UML, one must identify all the possible states of any particular entity.
Statecharts is a visual language for designing and programming reactive, embedded systems. • Statecharts extends finite state machines by four concepts: – Hierarchy (nested state) – Concurrency (orthogonal states)
A statechart is quite different from a finite state machine (I am assuming that this is what is meant by "conventional" state machine). Statecharts refer to Harel's notation invented in 1984, which was proposed as a significant notational extension over traditional finite state machines.
Statecharts have been incorporated in the UML language (although they refer to it as behavioural state machines, and UML also supports another notion called protocol state machines to add to the confusion).
The main important differences are that statecharts are actually a kind of "hierarchical" state machines. States can contain nested state machines (at any level of depth). In addition to this, the notion of orthogonal regions has been added to model different sub-statecharts running in parallel, and the notion of history states (either shallow history or deep history) can be used to remember which substate to visit when re-entering a composite state.
All of these extra features make statecharts much more scalable and expressive than simple, flat, state machines. Statecharts also allow adding actions associated with events (either inside a state or on a transition between states).
Many different (often commercial) tools exist that allow to fully generate executable code from a statechart or to simulate model behaviour (e.g. StateMate, Rhapsody, Stateflow, Yakindu Statechart Tools, visualSTATE, and many more). They are also frequently used in industry, mostly in the domain of embedded and reactive systems.
This is why statecharts can be considered as one of the success stories of executable modelling.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With