- 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:

- Web前端開發技術:HTML、CSS、JavaScript(第3版)
- Python 3.7網絡爬蟲快速入門
- Oracle從新手到高手
- Python Deep Learning
- Responsive Web Design with HTML5 and CSS3
- C#程序設計(慕課版)
- React.js Essentials
- Implementing Cisco Networking Solutions
- CKA/CKAD應試教程:從Docker到Kubernetes完全攻略
- Modern JavaScript Applications
- Flutter跨平臺開發入門與實戰
- Visual Basic程序設計上機實驗教程
- INSTANT Sinatra Starter
- Python圖形化編程(微課版)
- Bootstrap for Rails