This is a design flaw because, in practice, such a call can be easily forgotten. In this article, CoR implementations of Microsoft Windows global hook and Java servlet filter framework are used as examples to demonstrate that flaw.
A solution is proposed, and an action chain that allows multiple actions to handle an HTTP request in the Struts framework is discussed.
The buzzwords for software design are "decouple, decouple, and decouple." The fundamental flaw of the classic CoR implementation suggested by GoF is that the chain execution decision-making, which is not the business of subclasses, is coupled with request-handling in the subclasses. That violates a principle of object-oriented design: an object should mind only its own business. The solution is to decouple the chain execution decision-making and the request-handling by moving the next node call to the base class. Let the base class make the decision, and let subclasses handle the request only. By steering clear of chain execution decision-making, subclasses can completely focus on their own business, thus avoiding stopping the chain by accident.The Chain of Responsibility pattern's pitfalls and improvements