Difference between state machine and flowchart

I can design the work flow with both state machine and flowchart. I want to know the exact reason for introducing state machines. I am searching for simple and logival answers

3 Likes
  1. Complex transitions are much clearer with SM’s, as they are not bound to check the same thing. For example you can have n transitions from a state, each checking a completely different condition.
  2. Flowcharts do not inherently have a concept of waiting for something to happen. State machines do (a transition will not occur until trigger completes and condition evaluates to true; it will wait/loop indefinitely until then).
  3. State machines are better in describing a continously running mechanism (f.e. a robot). Flowcharts are better at describing a branching sequence of actions.
  4. State machines naturally encapsulate action groups, flowcharts don’t.

In WF4/UiPath scenarios, as long as the complexity is relatively low, you can get away with using them interchangeably (using designing flowcharts in these situations is easier), but once you start using sentences describing events (“on startup”, “on clean up” etc.) it’s a good sign you might be using a flowchart to describe a state machine.

In general I agree with UiPath’s recommendation to use a state machine as a high level controller. States clearly separate what belongs where. For deeper levels I’ve found a mix of flowcharts and sequences work best, but that’s specific to what you’re doing.

This (PDF) says it better than I could for general purpose scenarios.

29 Likes

Thank you Anrzej Kniola. I got clarity now

Great Description

Hi Andrzej, I didn’t understand your last point -

  1. State machines naturally encapsulate action groups, flowcharts don’t.

Can you please elaborate it ?

Hi Sathish,

I have attached one small real time example as per my learning about State Machine.

Somebody:- Please correct me if am really wrong.

Happy Robot!

2 Likes