Monday, November 4, 2013

Chain of Responsibility, aka CoR




What it means


CoR UML Digram
Processing or handling the request in a chained fashion, where all the objects are either equally capable or capable of executing the request based on certain conditions. If one object can not process, the request is passed on to the next available handler in the chain, and so on. And, the request is finally processed by one of them.



Applications of CoR

  • Rule engine to apply n number of rules
  • A parsing engine, similar to XML Parsing
  • Assigning the responsibility to an available executor, for example, in a chat based support application

And..many more if you look around. My imagination is compilers and interpreters too are based on this design pattern.

References


How it is similar or different from other patterns?

Often, the question arises, why CoR is different from Strategy, decorator and command etc. Below are the links where we can find some useful discussion:

No comments:

Post a Comment

Prototype

Prototype is another creation pattern. Intent:  - Intent is to create objects by cloning existing instance  - Specify the kinds of obj...