什么是“高级模块”和“低级模块” (在依赖性反转原理的背景下)? [英] What are "High-level modules" and "low-level modules" (in the context of Dependency inversion principle)?

查看:276
本文介绍了什么是“高级模块”和“低级模块” (在依赖性反转原理的背景下)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读维基百科的依赖反转原理定义,它使用两个术语高级模块低级模块,我无法弄清楚。

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?

推荐答案

这些定义在介绍性句子中给出:

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.

这篇关于什么是“高级模块”和“低级模块” (在依赖性反转原理的背景下)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆