Responsibility chain: link the processing flow responsible by each module to form a chain. When all requested data enters this chain, it will be processed by each module on the chain from chain head to chain tail.

For example, the Java EE Filter is the chain of responsibility. All requests must pass through this Filter chain, and each node that passes through it will be processed by this node. If the request meets the filter criteria, it goes to the next filter node until it reaches the end of the filter chain.

Because the filter chain is the structure of a linked list, so that means if I need to add a filter condition, I add a filter node to the filter chain; Similarly, to reduce one filter condition, remove it from the list. This makes it easy to manage filtering rules dynamically and layer by layer on each filtering node.

Model analysis:

1. If a processing rule or process is too large, break it up into several rules or processes and string them together to form a chain of responsibilities. In this way, each node is responsible for only a portion of the rules and processes, making maintenance and change friendly. At the same time, if a rule or process is not needed, remove the corresponding node. The same goes for adding rules and processes.