Posts

Showing posts with the label Chain of Responsibility Pattern

Design Patterns Series 6 - Chain of Responsibility Pattern

In previous post we  discovered one of design patterns that keep your object  know when something has happened and passing a notification to an observer, Observer Pattern, this post will explore another one. Chain Of Responsibility Pattern like observer pattern it lets you notify objects of change, but this time, the objects are connected in a chain, in series. The notification goes from one object to the next until an object is found that can handle the notification. This pattern is all about connecting objects in a chain of notification; as a notification travels down the chain, it is handled by the first object that is set up to deal with the particular notification. This pattern should " Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request. Chain the receiving objects and pass the request along the chain until an object handles it. " You use this pattern when not all your observers are created equa...