State Transition Diagram - State Diagrams Versus Flowcharts

State Diagrams Versus Flowcharts

Newcomers to the state machine formalism often confuse state diagrams with flowcharts. The figure below shows a comparison of a state diagram with a flowchart. A state machine (panel (a)) performs actions in response to explicit events. In contrast, the flowchart (panel (b)) does not need explicit events but rather transitions from node to node in its graph automatically upon completion of activities.

Graphically, compared to state diagrams, flowcharts reverse the sense of vertices and arcs. In a state diagram, the processing is associated with the arcs (transitions), whereas in a flowchart, it is associated with the vertices. A state machine is idle when it sits in a state waiting for an event to occur. A flowchart is busy executing activities when it sits in a node. The figure above attempts to show that reversal of roles by aligning the arcs of the state diagrams with the processing stages of the flowchart.

You can compare a flowchart to an assembly line in manufacturing because the flowchart describes the progression of some task from beginning to end (e.g., transforming source code input into object code output by a compiler). A state machine generally has no notion of such a progression. The door state machine shown at the top of this article, for example, is not in a more advanced stage when it is in the "closed" state, compared to being in the "opened" state; it simply reacts differently to the open/close events. A state in a state machine is an efficient way of specifying a particular behavior, rather than a stage of processing.

Read more about this topic:  State Transition Diagram

Famous quotes containing the words state and/or diagrams:

    “Well, well,” he said to himself, “you are not in Belgium; let us begin our apprenticeship in earnest, and so long as we are in the woods, howl heartily with the wolves.”
    —For the State of Nebraska, U.S. public relief program (1935-1943)

    Professors could silence me then; they had figures, diagrams, maps, books.... I was learning that books and diagrams can be evil things if they deaden the mind of man and make him blind or cynical before subjection of any kind.
    Agnes Smedley (1890–1950)