DEV Community

Discussion on: An IoC pattern to avoid repetitive if statements

 
tomazfernandes profile image
Tomaz Lemos

Perhaps in this case a Chain of Responsibility would be a better pattern? The instance tries to handle the input, if it can't it relays to the next in the chain...

About can and should, I guess it's a matter of semantics... Maybe an instance could handle an input but shouldn't? That's a good point to reason about.

I'm really glad you liked the idea, thanks a lot for your feedback!