控制的依赖注入和反转 - 术语 [英] Dependency Injection and Inversion of Control - terminology
问题描述
在某个级别上,函数可能是'所谓的'带有一些参数。
我想知道:这也叫做依赖注入吗?
此外:DI的这种用法是否导致控制反转?
依赖注入是一个概念。
你也许可以用功能语言实现DI(将函数作为参数传递)。
可以有很多方法来实现DI,每种语言都可能有实现DI的方式。
DI是IoC的一种特殊形式。因此,所有DI都是IoC,但不是相反。
所以你说得对DI的这种使用导致IoC是正确的。
In functional programming, functions are regarded as entities, and can be passed around as objects are in an OO context.
At some level, the function may be 'called' with some arguments.
And I was wondering: is this, too, called Dependency Injection?
And further: does this usage of DI result in Inversion of Control?
Dependency Injection is a concept.
You could perhaps "implement" DI in functional languages using this (the ability to pass functions as parameters). There could be many ways to achieve DI and each language might have its ways of implementing DI.
DI is a specialized form of IoC. Thus all DI is IoC but not the other way round. So you are right in saying that this usage of DI results in IoC.
这篇关于控制的依赖注入和反转 - 术语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!