简体   繁体   English

“后期约束力”与“控制权倒置”之间有什么关系?

[英]What is the relationship between “late binding” and “inversion of control”?

In his definition of OOP, Alan Kay points out he supports "the extreme late-binding of all things". 艾伦·凯(Alan Kay)在对OOP的定义中指出,他支持“万物的极端后期约束力”。 Does his interest in late-binding share the same motivation as people's interest in IoC? 他对后期绑定的兴趣与人们对IoC的兴趣是否具有相同的动机?

In particular, would it be correct to say that both are motivated by the concept "specify as little as possible, and leave implementation details to be filled in later"? 特别是,说两者都受“尽可能少指定,而让实施细节留待以后填写”这一概念是正确的吗?

It depends what you mean by inversion of control - the term has been overloaded to include dependency injection, but they are really different concepts. 这取决于您对控制反转的含义-该术语已重载以包含依赖项注入,但它们实际上是不同的概念。 IoC originally described a method of controlling program flow, whereas DI is specifically concerned with reducing coupling between types. IoC最初描述了一种控制程序流的方法,而DI特别涉及减少类型之间的耦合。

That said, it could be argued that all these methods/patterns/philosophies share the same fundamental principle: to lower the cost of change. 话虽这么说,但所有这些方法/模式/哲学都具有相同的基本原理:降低变更成本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM