What do you usually use for managing reversable procedural code/state changes (Finite State Machine)?

We’re trying to implement a user onboarding path that needs to be able to reverse to the last state on failure.

We’ve found a few libraries that could be potential solutions, however they seem relatively inactive. We considered using Sage, which implements the saga pattern, as well as a few state machine libraries: fsmx and machinery. Fsmx seems to be the most active library as of now.

Do you normally use one of these (or a similar) library, or do you implement it using gen_statem or gen_fsm?

1 Like

Fsmx is pretty awesome. I think we’ll go with that.

I personally would reach for gen_statem, if the steps are relatively simple. Its a matter of returning next_state or keep_state and replying to a call with an appropriate error if validation fails. gen_fsm is deprecated.

1 Like