State Machine Diagram VS Flowchart
Asked Answered
C

2

7

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.

Cower answered 1/1, 2022 at 10:33 Comment(0)
S
9

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.

Suzysuzzy answered 1/1, 2022 at 14:42 Comment(0)
H
1

As you mentioned, a State Machine Diagram focus on display from which state to which state the execution goes based on the input.

Although a State Machine can be handled as a specialized form of a flow chart / activity chart.

Hammack answered 1/1, 2022 at 12:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.