- Hands-On Design Patterns with Java
- Dr. Edward Lavieri
- 290字
- 2021-06-24 14:58:02
Understanding the chain of responsibility pattern
The purpose of the chain of responsibility design pattern involves senders and receivers. Specifically, the chain of responsibility design pattern calls for the decoupling of the sender and receiver. Objects can be sent to a series of receivers without the sender being concerned about which receiver handles the request. The request is sent along a chain of receivers and only one of them will process the request. Let's look at some examples of this.
Consider a large customer service agency that handles thousands of incoming emails each day. Instead of having a person or persons manually review each one to determine which department should process the email, we can write a Java program using the chain of responsibility design pattern to send the emails along the chain so that they are processed by the appropriate department.
Another example is a call center. Many call centers now ask the caller to briefly describe what they are calling about and then the caller is placed in a queue. The caller's brief descriptions are recorded and then analyzed for key words. The calls are routed along the chain and then processed by the appropriate agent. In cases when an agent receives a call that is not appropriate for them, say it is regarding billing and the agent handles shipping, then the call can be sent further down the chain.
We will further explore a third example that involves incoming emails to a university. The university has several functional areas and wants to ensure the emails are routed to the appropriate team. We will look at the use case, UML class diagram, and the source code necessary to implement the chain of responsibility design pattern for this scenario.
- 大數據技術基礎
- 程序員修煉之道:從小工到專家
- Python絕技:運用Python成為頂級數據工程師
- 大數據可視化
- 卷積神經網絡的Python實現
- Python數據分析:基于Plotly的動態可視化繪圖
- 3D計算機視覺:原理、算法及應用
- OracleDBA實戰攻略:運維管理、診斷優化、高可用與最佳實踐
- Starling Game Development Essentials
- R語言數據挖掘
- 區域云計算和大數據產業發展:浙江樣板
- Access 2010數據庫程序設計實踐教程
- Google Cloud Platform for Architects
- 數據分析方法及應用:基于SPSS和EXCEL環境
- 算力芯片:高性能CPU/GPU/NPU微架構分析