Learn something new every day
More Info... by email
The chain of responsibility (CoR) involves the process of indicating the activities and responsibilities of each and every entity in the object oriented design pattern. There are two basic elements in an object oriented design; command objects and processing objects. The command objects generate the commands to the processing objects and the processing objects choose from the commands that they can handle and pass the rest to the others in the chain. This is the basic principle in object oriented design, and there is a lot more flexibility in the design, such as the new enclosure of the objects at any location in the design pattern of the chain of responsibility.
The advantage behind the object oriented design is that communication is not limited to the sender and the receiver because there are many objects there to handle the sender's command. There is a chain of different objects that line up to handle the commands, and if one cannot handle it then it can pass it on to the next one in the chain. The chain of responsibility continues to go on until one of the objects accepts the command.
The chain of responsibility needs to be more flexible and support the addition of new handlers in the chain. Since each handler is not able to do each and every task, there must be a group of the handlers that can work collectively. There could be some drawbacks to the chain of responsibility as some of the commands remain unsolved, even at the end of the chain. To address this issue, one solution is to implement all the handlers for all the possible requests.
There could be some problems related to the broken links in the chain of responsibility system. If the programmer forgets to link the commands then the request could get lost. The request representation is significant because it is being used in all of the 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 handler, some requests may end up totally unaddressed at the end of the chain. But all in all, the chain of responsibility is a good system to implement if it has carefully been designed, considering all of the related aspects.
One of our editors will review your suggestion and make changes if warranted. Note that depending on the number of suggestions we receive, this can take anywhere from a few hours to a few days. Thank you for helping to improve wiseGEEK!