I am responsible for designing and implementing a recovery system around transactions. The transaction effectively has a finite state it can exist in ie Voided, Cancelled, Secured etc.
I am thinking that this state could/should be governed through a state machine. Scripts are ran that can throw events on the transaction (such as store recovery data) that would cause the transaction to alter state, or a user can click a button etc.
What do you think? I'm not sure I entirely understand the benefits that a FSM brings.
In general the benefits of an explicit finite state machine appear when the state transitions get complex. If you don't need logic to determine which state to go to next, then really what you have is just a state indicator rather than a state machine.
Can you explain a bit more about the transitions between states in your system?
Originally posted by Frank Carver: In general the benefits of an explicit finite state machine appear when the state transitions get complex.
And if your FSM is complex the program code can become rather tedious - one of the reasons why Robert C. Martin wrote the first incarnation of SMC to generate the FSM program code from a state transition table. Object mentor now has a Java version available. Look for SMC - Finite State Machine Compiler (Java) on the object mentor web site's Resources-Downloads page.