Search code examples
umldiagramstate-machineflowchartstate-diagram

State Machine Diagram VS Flowchart


What are the differences and similarities between the state machine diagram and flowchart?

So far I found that the state diagram shows us the actual change in the state, not the process or commands like in the flowchart.


Solution

  • In a state diagram, the nodes are states and the arrows correspond to something that happens that triggers a change of state.

    In a flow chart, the nodes are actions or decisions, and the arrows correspond to the flow of control, i.e. what happens next. Flow chart are not UML. The closest UML diagram is an activity diagram that allows you to meodell more precisely everything you can model with a flow-chart and more (since the arrows can also represent an object flow).

    Both can be complementary: an action/decision in a flow-chart could trigger events that cause changes of state. But it's not necessarily one for one: an action may cause several state changes without any evidence in the flow-chart that these may happen.

    Short and simplified example:

    • Imagine an Order object. It may have the state received, delivey in preparation, delivery complete, invoiced. Each of these state tells what can happen next with the order. That'll be a topic for astate diagram.
    • Imagine a flowchart. These are different actions happening in sequence: Get an order from customer, Pick items of the orders from the inventory, Send items to the customer, Are all items sent?, if yes, Prepare and send invoice, if no, Find missing items and then go back to Pick items ... and continue from there.

    As you see: both can tell the same story, but from a different angle with different details.