What are “High-level modules” and “low-level modul

2019-04-09 04:38发布

I was reading Wikipedia's definition of Dependency inversion principle, and it uses two terms High-level modules and low-level modules, which I wasn't able to figure out.

What are they and what does Dependency inversion principle have to do with them?

2条回答
Anthone
2楼-- · 2019-04-09 05:22

The definition of those are given in the introductory sentence:

high level: policy setting
low level: dependency modules.

In laymen's terms: high level modules depend on low level modules, but shouldn't depend on their implementation. This can be achieved by using interfaces, thus decoupling the definition of the service from the implementation.

查看更多
混吃等死
3楼-- · 2019-04-09 05:23
  1. low level module is a programme written to solve a particular problem (vat calculation based on country code)
  2. high level module is a programme written to solve a general problem (database access)
查看更多
登录 后发表回答