Is there a design pattern (like visitor, strategy, state, etc.), or some other design principle, for helping to design a good solution for simulating a flow in states for an entity, for example a Task entity.
A Task starts in New status, then progresses to BeingHandled status, then WaitingForApproval and then it can either be moved to Finished or NotApproved, which is essentially back to BeingHandled with additional info, saying that it is back from WaitingForApproval.
So in general we have some general flow, and then we can have some inner flow within it.
Thanks,
ashilon
It's not a pattern but a concept: finite-state machine.
In summary, it's a state machine which can only have an active state in a moment in time.
Check what Wikipedia article says on its first paragraph:
A finite-state machine (FSM) or finite-state automaton (plural: automata), or simply a state machine, is a mathematical model of computation used to design both computer programs and sequential logic circuits. It is conceived as an abstract machine that can be in one of a finite number of states. The machine is in only one state at a time; the state it is in at any given time is called the current state. It can change from one state to another when initiated by a triggering event or condition; this is called a transition. A particular FSM is defined by a list of its states, and the triggering condition for each transition.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With