为什么有这么多的术语说同一件事? IoC和DIP [英] Why so many terms to say the same thing? IoC and DIP
问题描述
IoC =控制权反转
DIP =依赖反转原理(S.O.L.I.D.中的D)
DIP = Dependency Inversion Principle (D in S.O.L.I.D.)
IoC == DIP ?我认为是真的.
IoC == DIP? I think so, is true.
构建软件的世界已经如此混乱,为什么要用太多的单词来表达同一件事?
The world of building software is already so messy, why so many words to say the same thing?
(我知道 DI (依赖项注入),它与 DIP 和 IoC 不同)
(I know DI (Dependency Injection) and it is different of DIP and IoC)
更新:
根据答案,我们可以说:( DI )+( IoC )=(依赖反转原理)?
According to the answers, then we can say that: (DI) + (IoC) = (Dependency Inversion Principle) ?
推荐答案
控制反转是通用术语.依赖注入是一种特定类型的IoC.
Inversion of Control is the generic term. Dependency Injection is a specific type of IoC.
请参见控制容器的反转和依赖项注入模式.
依赖反转原理是一个准则,而其他术语则描述了技术. (IoC也可以用来描述原理,因此可能会造成混淆.)
The Dependency Inversion Principle is a guideline, while the other terms are descriptive of techniques. (IoC can be used to describe a principle as well, so this can be confusing.)
在句子中使用:
Sue通过使用依赖关系遵循了依赖关系反转原则 注入她的类的构造函数并创建实例 控制容器反转.
Sue followed the Dependency Inversion Principle by using Dependency Injection in the constructor of her class and creating instances with an Inversion of Control container.
更新:
我不认为(DI)+(IoC)=(依赖倒置原则)是准确的.这就像说(苹果)+(食物)=(良好营养).每个术语都有特定的含义.
I do not feel that (DI) + (IoC) = (Dependency Inversion Principle) is accurate. That's like saying (Apple) + (Food) = (Good Nutrition). Each term has a specific meaning.
这篇关于为什么有这么多的术语说同一件事? IoC和DIP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!