dimanche 4 octobre 2020

What Design pattern should I use? Give me your thoughts

I have an application that has multiple If/else conditions and based on its result it would process the inputs and convert them into a "message" object.

My initial thought was to make a "rules engine" pattern (aka chain of responsibility) but I am stuck because for some of the rules if that rule turns false it should not skip the whole process it should take a different route, check for some other sub steps and then process it. So this looks like more of a "Workflow" pattern (conditional workflow).

Example of my business logic rule is If Object A is null --> Go to Route "z" --> check if object is eligible for process --> Run the process "X" If Object A is not null --> Run check "1" --> If check 1 is true --> Do check "2" --> If check 2 is true --> Go to Route "z" --> If check 1 is false --> Don't check "2"

So what pattern do you use? Is this Rules engine or Workflow or not fit in any pattern? Can I use j-easy rules or workflow if anyone applies? What are ur thoughts?

Aucun commentaire:

Enregistrer un commentaire