DEV Community

Discussion on: Chain Of Responsibility Design Pattern

Collapse
 
novicedev7291 profile image
Kuldeep Yadav

Hi Abhisar, I think creating a chain of filter would involve some logic and will depend on use case, however if the logic is required to be changed at runtime, then strategy pattern may fit well, factory generally used to hide the object creation from caller code but here we are appending filters in chain which could follow some rules.

Although, it is not required to apply any pattern here, we just need to delegate the responsibility of creating the chain somewhere so that it can be changed without touching any other class, once it is done, we can apply any pattern which suits well to that logic as per use case.