关于IOC和DI讨论
刚刚看了?spring3最新最全的免费PPT下载,第一手拿到的内部资料,分享给各位?这篇帖子中的PPT,在PPT中 把 IOC和DI详细的讲解了一个遍,不知道为什么,我是看着这个讲解越看越觉得越让人迷惑。且看下图
?这是直接截取的PPT的内容,我真不知道这样来描述这所谓的2个概念需要让看客们如何理解...
?
同时我们可以去看看?Martin Fowler的 ??Inversion of Control Containers and the Dependency Injection pattern??
或者中文版本:http://simplejee.googlecode.com/files/DependencyInjection.pdf
?
在这个文章中如果说我没有理解错误的话,作者很清楚的描述了IOC和DI在他们支撑着的是都实现了相同的一个模式,而这个模式决定了使用的容器组件装配的方式。
“In the Java community there's been a rush of lightweight containers that help to assemble components from different projects into a cohesive application. Underlying these containers is a common pattern to how they perform the wiring, a concept they refer under the very generic name of "Inversion of Control". In this article I dig into how this pattern works, under the more specific name of "Dependency Injection", and contrast it with the Service Locator alternative. The choice between them is less important than the principle of separating configuration from use.”
?
但但这个PPT里所描述的这二者如果按正常的理解的话和这篇文章的描述应该是有出入的吧....
?
?
欢迎大家扔砖头.
?
?