Skip to content

Commit 60fe8ea

Browse files
committed
ChainOfResponsibility definition and applicability
1 parent 3a78270 commit 60fe8ea

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,18 @@ Define the skeleton of an algorithm in an operation, deferring some steps to sub
4444

4545
* A class defines many behaviors, and these appear as multiple conditional statements in its operations. Instead of many conditionals, move related conditional branches into their own Strategy class.
4646

47+
48+
#### 5.Chain of Responsibility
49+
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 request along the chain until an object handles it. [example](https://github.com/hbrawnak/php-design-pattern/blob/master/ChainOfResponsibility/index.php#L3)
50+
51+
##### Applicability:
52+
Use the Chain of Responsibility pattern when
53+
54+
* More than one object may handle a request, and the handler isn't known a priori. The handler should be ascertained automatically.
55+
56+
* You want to issue a request to one of several objects without specifying the receiver explicitly.
4757

58+
* The set of objects that can handle a request should be specified dynamically.
4859

4960
--------
5061
Sources:

0 commit comments

Comments
 (0)