- 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.
- iOS Game Programming Cookbook
- Oracle從入門到精通(第3版)
- Hyper-V 2016 Best Practices
- 零基礎(chǔ)學(xué)Python網(wǎng)絡(luò)爬蟲案例實戰(zhàn)全流程詳解(高級進(jìn)階篇)
- concrete5 Cookbook
- VMware虛擬化技術(shù)
- Angular開發(fā)入門與實戰(zhàn)
- 基于ARM Cortex-M4F內(nèi)核的MSP432 MCU開發(fā)實踐
- Mastering C++ Multithreading
- 大話Java:程序設(shè)計從入門到精通
- Java圖像處理:基于OpenCV與JVM
- 計算語言學(xué)導(dǎo)論
- R語言實戰(zhàn)(第2版)
- 虛擬現(xiàn)實建模與編程(SketchUp+OSG開發(fā)技術(shù))
- 例解Python:Python編程快速入門踐行指南