- Design Patterns and Best Practices in Java
- Kamalmeet Singh Adrian Ianculescu LUCIAN PAUL TORJE
- 155字
- 2021-06-25 20:52:36
The chain-of-responsibility pattern
Computer software is for processing information, and there are different ways of structuring and processing that information. We already know that when we talk about object-oriented programming, we should assign a single responsibility to each class in order to make our design easy to extend and maintain.
Consider a scenario where multiple types of operations can be performed on a set of data that comes with a client request. Instead of adding information about all the operations in a single class, we can maintain different classes responsible for the different types of operations. This helps us keep our code loosely coupled and clean.
These classes are called handlers. The first handler will receive the request and take a call if it needs to perform an action, or pass it on to the second handler. Similarly, the second handler checks and can pass on the request to the next handler in the chain.
- Learning NServiceBus(Second Edition)
- OpenDaylight Cookbook
- HTML5移動Web開發(fā)技術(shù)
- Interactive Data Visualization with Python
- Java Web應(yīng)用開發(fā)技術(shù)與案例教程(第2版)
- Rust Essentials(Second Edition)
- Learning Hunk
- Active Directory with PowerShell
- Python深度學(xué)習(xí):模型、方法與實現(xiàn)
- Vue.js 2 Web Development Projects
- Learning Unreal Engine Game Development
- 安卓工程師教你玩轉(zhuǎn)Android
- Kohana 3.0 Beginner's Guide
- 網(wǎng)絡(luò)綜合布線與組網(wǎng)實戰(zhàn)指南
- 微信公眾平臺服務(wù)號開發(fā):揭秘九大高級接口