The chain of responsibility in object-oriented design involves assigning activities and responsibilities to entities. Processing objects handle commands passed down from control objects, with flexibility to add new handlers. However, glitches and broken links may occur if not carefully designed.
The chain of responsibility (CoR) involves the process of indicating the activities and responsibilities of each entity in the object-oriented design model. There are two basic elements to an object-oriented design; control objects and processing objects. Command objects generate commands for processing objects, and processing objects choose from commands they can handle and pass the rest on to others in the chain. This is the basic principle in object-oriented design, and there is much more flexibility in design, such as new wrapping of objects anywhere in the chain of responsibility design pattern.
The advantage behind object oriented design is that the communication is not limited to the sender and receiver because there are many objects there to handle the command of the sender. There is a chain of different objects that line up to handle commands, and if one can’t handle it, it can pass it to the next in the chain. The chain of responsibility continues until one of the objects accepts the command.
The chain of responsibility needs to be more flexible and support the addition of new managers in the chain. Since each handler cannot perform all tasks, there needs to be a group of handlers who can work collectively. There may be some glitches in the chain of responsibility as some of the commands remain unresolved, even at the end of the chain. To solve this problem, one solution is to implement all handlers for all possible requests.
There might be some broken link issues in the chain of accountability system. If the programmer forgets to wire the commands, the request may be lost. The impersonation of the request is significant because it is used in all components of the chain of responsibility. Another flaw that could be in the design of the CoR is that, due to some problems in the concrete manager, some requests might end up not being addressed at the end of the chain. But all in all, the chain of responsibility is a good system to implement if it has been carefully designed, considering all related aspects.
Protect your devices with Threat Protection by NordVPN