11

I have heard people using these terms.

I wonder if they refer to the same thing or is there a difference between these two?

hippietrail
  • 13,703
  • 15
  • 87
  • 133
ajsie
  • 70,516
  • 97
  • 259
  • 375

3 Answers3

17

Wikipedia actually covers this pretty well. http://en.wikipedia.org/wiki/State_diagram

State machines have been around for a long time (decades at least). They consist of states (usually circles) and arrows between the states where certain actions can trigger an transition along an arrow. Moore and Mealy machines are the two main variants, which indicate whether the output is derived from the transitions or the states themselves.

Statecharts were invented by David Harel, and are sometimes called Harel Statecharts. He defined a pretty broad extension to typical state machines, with the goal of making state machines more useful for actual work with complicated systems.

A variant of Statecharts are build into Matlab now, as stateflow, which is an extension of simulink. Statesharts are also the basis of the UML "State Machine Diagrams".

Pursuit
  • 11,812
  • 1
  • 23
  • 40
  • Hi @Pursuit! the state diagram in UML build on the idea of State machines(Moore and Mealy machines) or Statecharts (Harel Statecharts)? – Chriss Sep 16 '13 at 14:50
  • 2
    UML state machine diagrams are based on Statecharts. The most obvious feature is superstates and concurrent orthogonal states. – Pursuit Sep 16 '13 at 15:17
  • thanks to you dear friend@Pursuit:) Does that mean that the state chart not corresponds to state diagram but it is only built on its concepts? – Chriss Sep 16 '13 at 15:54
  • 1
    UML State machine diagrams have clearly been significantly influenced by Harel Statecharts. However, I don't think that either Harel Statecharts or UML State Diagrams are specific enough to meaningfully discuss if they are equivalent or not. We are stuck with statements like "[a state diagram] is essentially a Harel statechart with standardized notation" (from http://en.wikipedia.org/wiki/State_diagram_%28UML%29). – Pursuit Sep 16 '13 at 16:19
0

Learn more about Stateflow in general at: https://www.mathworks.com/help/stateflow/examples.html

Stateflow has been updated for making it very easy to create state machines and flow charts in R2012b.

The major updates include a new graphical editor, state transition tables, MATLAB as the action language and an integrated debugger.

Nick Alexeev
  • 1,456
  • 2
  • 20
  • 34
0

From the seminal 1999 book "Constructing the User Interface with Statecharts" by Ian Horrocks, published by Addison-Wesley (bold/italicized for emphasis):

From the very nature of user interfaces, it is apparent that states and events are a natural medium for describing their behaviour. Finite state machines are a formal mechanism for collecting and co-ordinating such fragments to form a whole. However, it is generally agreed that, because of the large number of states and events organized in an unstructured way, finite state machines are not appropriate for describing complex systems. The feasibility of a state-based approach for specifying a user interface relies on a specification language that results in diagrams that are concise, well structured, modular and hierarchical.

There are many different notations used to represent finite state machines, such as state transition diagrams and state transition matrices. However, such notations do not address the fundamental problems associated with finite state machines. The statechart notation is not just another notation for a finite state machine; statecharts are a major step forward for state-based notations. They provide a much richer and much more powerful specification language than any finite stale machine notation. All the serious problems associated with finite stale machines are solved by statecharts:

  1. The number of states in a statechart rises in proportion to the complexity of the system being specified. In finite state machines, the number of states tends to increase rapidly with only a modest increase in the complexity of the system being specified.
  2. Statecharts avoid duplicate states and duplicate event arrows. This avoids large, chaotic diagrams that are difficult to understand and difficult to modify.
  3. The states in a statechart have a hierarchical structure, which means the system being modelled can be considered at different levels of abstraction. The modular nature of the states ensures that it is not necessary to understand an entire statechart in order to understand just one part of it. In a nutshell, statecharts are to state transition diagrams what modular decomposition and abstraction are to monolithic code
kotpal
  • 347
  • 4
  • 11