• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is a FSM a good fit?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi People

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.

Cheers
Mike
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic