Chain of responsibility is a type of behavioural pattern. Whenever there is a situation where there are more than one object handles commands and the handler is not known in advance, the client is not aware of the handler in advance, and it is taken care automatically. And the request to be handled is handed over to a group of objects to process the request in a dynamic way.
Take an example of approval for an opening in a company. Once the manager has created a requirement of the opening/role, it needs to go through multiple hierarchies for approval from HR, Finance, Business etc. Approval from all departments if comes positive then only the overall approval status of the requirement is positive.
Posted Date:- 2021-09-06 20:51:16