What is a chain of responsibility?

businessman making thumbs up

The chain of responsibility (CoR) involves the process of indicating the activities and responsibilities of each entity in the object-oriented design pattern. There are two basic elements in an object-oriented design; command objects and processing objects. Command objects generate commands to process objects, and processing objects choose the commands they can handle and pass the rest to others in the chain. This is the basic principle of object-oriented design, and there is much more flexibility in the design, such as re-wrapping objects anywhere in the chain-of-custody design pattern.

The advantage behind object oriented design is that the communication is not limited to the sender and recipient as there are too many objects there to handle the sender’s command. There’s a chain of different objects that line up to handle the commands, and if no one can handle that, you can pass it to the next one in the chain. The chain of responsibility continues until one of the objects accepts the command.

The chain of custody needs to be more flexible and support the incorporation of new managers in the chain. Since each controller is not capable of performing all tasks, there must be a group of controllers that can work collectively. There may be some downsides to the chain of responsibility, as some of the commands are left unresolved even at the end of the chain. To resolve this issue, one solution is to implement all handlers for all possible requests.

There may be some issues related to broken links in the chain of custody system. If the programmer forgets to bind the commands, the request may be lost. The representation of the application is important because it is used in all components of the chain of custody. Another flaw that may exist in the CDR design is that due to some issues in the concrete handler, some requests may be completely unresolved at the end of the chain. But in general, chain of custody is a good system to implement if it is carefully designed with all the related aspects in mind.

See also  What is energy industry analysis?

Related Posts