2017-04-01 17:15:59 +03:00
..
2017-02-11 21:46:56 +02:00
2016-11-27 14:34:20 +02:00

layout, title, folder, permalink, pumlid, categories, tags
layout title folder permalink pumlid categories tags
pattern Chain of responsibility chain /patterns/chain/ 9SR13SCm20NGLTe1OkxTXX0KKzd4Wa-pVYlrdTxJN4OTMZ4U7LZv8Wg-ssdejLTgoELGHvDhaesw6HpqvWzlXwQTlYq6D3nfSlv2qjcS5F9VgvXjrHnV Behavioral
Java
Gang Of Four
Difficulty-Intermediate

Intent

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.

alt text

Applicability

Use Chain of Responsibility when

  • more than one object may handle a request, and the handler isn't known a priori. The handler should be ascertained automatically
  • you want to issue a request to one of several objects without specifying the receiver explicitly
  • the set of objects that can handle a request should be specified dynamically

Real world examples

Credits