Can you recommend a design pattern for dealing with workflows?

I am wondering how to represent a decision tree while also making it easy to maintain and each step should be unit-testable on its own.

I want to avoid a big if-else-block, but I am also unsure what design pattern to apply here.

Basically, there a bunch of yes-no-question (though some conditions may be more complex) that can be nested very deeply, and depending on a certain set of requirements we want to display different actions.

(The workflow is fixed, there is only 1 at at time yet it may change a lot over the next iterations until we figure out what our userbase wants.)

  • 0
    binary flags?
  • 2
    I’m sick so pardon if this doesn’t make sense. But how about a state machine?
  • 1
    @Root Actually, I was already thinking in the direction of a state machine, so you are at least playing in my confirmation bias :)
  • 0
    ActorModel, Event Store and Streams
Add Comment