One aspect of DI frameworks that causes confusion is the terminology used to describe them.
DI框架造成混乱的一个方面是用来描述它们的术语。
These are just some of the problems facing DI implemented using conventional factory implementations.
这就是使用常规的工厂实现法实现DI所要面对的一些问题。
When the 386 came out, they stretched the various registers to 32bits, and they fixed the restrictions that only BX, SI, DI and BP could be used as index registers.
当386出来后,它们扩充不同的寄存器到32位,而且它们修复了限制,即仅BX,SI,DI和BP能被用作索引寄存器。
This series of articles demonstrates what a powerful code reuse mechanism DI is.
本系列演示了DI是多么强大的代码重用机制。
They prefer that a class be totally ignorant of the DI framework.
他们更喜欢一个完全忽略DI框架的类。
In a sense though dependency injection is not technically particularly interesting; really what DI frameworks do is offer a backbone for interactions between objects.
虽然在某种意义上依赖注入在技术上并没什么特别的;实际上DI框架所做的就是为对象之间的交互提供一个中枢。
When everything is managed by the DI container, the service locator can be thanked for its good work and deleted.
当所有一切都由DI容器管理之后,服务定位器就可以完成它的历史使命并被删除了。
DI provides yet another way to eliminate high coupling between components, because the container can inject a component at run time into a component that relies on it.
因为容器能够在运行时把组件注入到依赖它的组件中,所以DI提供了消除组件间高度耦合的另外一种方式。
Many of the previous shortcomings to DI can be solved by using a container. A container is a compartment that houses some sort of abstraction within its walls.
许多先前的针对DI的缺点,通过使用容器都能够解决,容器是一个把一些抽象驻留在它的墻之内的隔离间。
For DI to work, you must have an interface whose concrete class you can inject into the consumer of the behavior you desire.
为了让DI工作,必须拥有一个接口,可以把这个接口的具体类注入到需要的行为的消费者中。
This behavior is referred to in the DI world as constructor injection, because the instance is passed through one of the constructors.
这个行为在DI世界中称作构造函数注入,因为实例是通过一个构造函数传递的。
The DI framework is a backbone not only for interactions between application components, but also for interactions between application components and infrastructure.
DI框架是这样一种中枢:不仅可以供应用程序组件间交互使用,还可以供应用组件和基础设施间交互使用。
DI is a code reuse technique that has existed for years, but only now are programmers starting to reap the real benefits of the extremely loose coupling that it provides.
DI是一种已经存在多年的代码重用技术,但是只有现在程序员才开始享受它所带来的极度松散耦合的真正好处。
Speaking of production code, one downside to DI is that it can feel viral.
说到生产代码,DI的一个缺点是它可能感染病毒。
Many proponents of DI prefer constructor injection, because it means that the injected class never exists in a state where its dependencies aren「t present.
许多DI的支持者愿意采用构造函数注入,因为这意味着注入的类永远不会出现依赖项不存在的情况。
But if that were true, DI would never have caught on.
但如果是这样,DI就永远不会这么流行。
That article demonstrated why DI is an effective way to handle coupling points between classes that contain references to each other.
那篇文章演示了为什么DI是处理包含相互引用的类之间耦合点的有效方式。
I hope I」ve convinced you that DI adds value to your designs and that using a framework will make your life even easier.
我希望在我的介绍之后,您会相信DI能为您的设计增加价值,而且使用框架会使工作更轻松。