- Design Patterns and Best Practices in Java
- Kamalmeet Singh Adrian Ianculescu LUCIAN PAUL TORJE
- 138字
- 2021-06-25 20:52:31
Dependency inversion principle
"High-level modules should not depend on low-level modules. Both should depend on abstractions."
"Abstractions should not depend on details. Details should depend on abstractions."
In order to understand this principle, we must explain the important concept of coupling and decoupling. Coupling refers to the degree to which modules of a software system are dependent on one another. The lower the dependency is, the easier it is to maintain and extend the system.
There are different approaches to decoupling the components of a system. One of them is to separate the high-level logic from the low-level modules, as shown in the following diagram. When doing this, we should try to reduce the dependency between the two by making them depend on abstractions. This way, any of them can be replaced or extended without affecting other modules:

- Computer Vision for the Web
- PowerCLI Cookbook
- 你必須知道的204個(gè)Visual C++開發(fā)問題
- Java應(yīng)用開發(fā)技術(shù)實(shí)例教程
- Unreal Engine 4 Shaders and Effects Cookbook
- Python編程從0到1(視頻教學(xué)版)
- iPhone應(yīng)用開發(fā)從入門到精通
- Odoo 10 Implementation Cookbook
- Managing Microsoft Hybrid Clouds
- JavaScript編程精解(原書第2版)
- 高效使用Greenplum:入門、進(jìn)階與數(shù)據(jù)中臺(tái)
- Java程序設(shè)計(jì)(項(xiàng)目教學(xué)版)
- Testing Practitioner Handbook
- 威脅建模:設(shè)計(jì)和交付更安全的軟件
- JavaScript Security