SOFTWARE DESIGN
DESIGN PATTERNS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Chain of Responsibility
|
|
Builder
|
|
Observer
|
|
Prototype
|
Detailed explanation-1: -Use the pattern when it’s essential to execute several handlers in a particular order. Since you can link the handlers in the chain in any order, all requests will get through the chain exactly as you planned. Use the CoR pattern when the set of handlers and their order are supposed to change at runtime.
Detailed explanation-2: -Wikipedia defines Chain of Responsibility as a design pattern consisting of “a source of command objects and a series of processing objects”. Each processing object in the chain is responsible for a certain type of command, and the processing is done, it forwards the command to the next processor in the chain.
Detailed explanation-3: -It has reference to the only first handler in the chain and does not know anything about the rest of the handlers. Concrete handlers : These are actual handlers of the request chained in some sequential order.