mercredi 17 février 2021

Design Pattern for conditional behaviour depending on a param

I need suggestions about the right choice of a design pattern.

I have three kind of tasks (but could be more in future) TaskA, TaskB, TaskC.

The controller receive some params and have to perform TaskA and TaskB if the param X has value major to 10, or TaskA, TaskB and TaskC if the param X has value equal or minor 10.

The goal is to be able to add all tasks with his own condition, in this case we could add easily other task or other conditions (i.e. TaskD if param Y has a certain value).

Is Chain of Responsibility the right Design Pattern to adopt? Should I use other patterns join to this one?

Aucun commentaire:

Enregistrer un commentaire