UML state machine, also known as UML statechart, is a significantly enhanced realization of the mathematical concept of a finite automaton in computer science applications as expressed in the Unified Modeling Language (UML) notation.
The concepts behind it are about organizing the way a device, computer program, or other (often technical) process works such that an entity or each of its sub-entities is always in exactly one of a number of possible states and where there are well-defined conditional transitions between these states.
Spring Statemachine - Projects
Spring statemachine - Reference Documentation
Simply put, a state machine allows to manage the transition between a state Sn to an other state Sn+1, or between the states from Sn to Sn-1, with the use of events
With a state machine you declare which states is expected depending oh the event used.
Here I have define this configuration :
- if I'm the the state S1 and then I receive the event E1 then I'm changing to the state S2
- then if I'm the the state S2 and then I receive the event E2 then I'm changing to the state S3
- otherwise, all other events on different states are to be refused
Then if we have this examples :
- let an entity at the state S1, if we use the event E1 then the transition will be accepted and the entity will have his state changed to S2
- let an entity at the state S1, if we use the event E2 then the transition will be refused and the entity will stay at its state S1
- let an entity at the state S2, if we use the event E2 then the transition will be accepted and the entity will have its state changed to S3
- let an entity at the state S2, if we use the event E1 then the transition will be refused and the entity will stay at its state S2
We will use a very simple model for the state-machine : an amazon order as everyone know it and can this way understand it
/!\ it's a false workflow, create just for the demonstration /!\