Friday, January 01, 2021

The Chain of Responsibility

let's study the UML

In this post I want to discuss the Chain of Responsibility design pattern and how the UML is structured.

We want to couple the request of a sender to its receiver. 

If more than one object can handle the request, then the system should ascertain which object should handle it


We are given a list of objects that may handle that request and you want to be able to evaluate which object should handle the given request at runtime.







The Handler defines an interface that’s capable of handling the request.

If it can not handle request, the request is sent to the next handler

 

The concrete hander handles the request it is responsible for, if it can not handle this request, then the request is passed to the next object in the chain. 


If no concrete handler can handle the request, the request fall off the chain.


The client is the one who initiated the request...


No comments:

The Strategy Design Pattern a Behavioral Pattern using C++

The Strategy Design Pattern is a behavioral design pattern that enables selecting an algorithm's implementation at runtime. Instead of i...