I am working on a solution where I have implemented chain of responsibility pattern. All handlers in chain work independently and in some cases based on the input the chain is broken by a handler since there is no need to continue with the next handler. This has been working prefect until a new change request came in.:(
Now I have a case where I need to make a decision based on the result of my previous handler. Example: We have an object that based on FirstName and Last we build email and notify manager
First handler: Builds Email address (if it does not exists)
Second handler: if email has been created(and is not a new one) we need to notify manager
So the Second handler depends on the action/result of the First Handler
Choosing Chain of Responsibility: Am I breaking the pattern by wrapping the input and add some more data and use it as an input for my next handler?
Choosing Decorator: Am I breaking the pattern by breaking the chain in cases where I do not want the process to go further?
Or is there a third option?
Aucun commentaire:
Enregistrer un commentaire