Difference IoC container and Factory pattern
来源:互联网 发布:华为媒体算法工程师 编辑:程序博客网 时间:2024/06/06 11:24
1 I would suggest to keep the concepts plain and simple. Dependency Injection is more of a architectural pattern for loosely coupling software components. Factory pattern is just one way to separate the responsibility of creating objects of other classes to another entity. Factory pattern can be called as a tool to implement DI. Dependency injection can be implemented in many ways like DI using constructors, using mapping xml files etc.
2 Inversion of Control (IoC) and Dependency Injection (DI) usually refer to the same thing. IoC is a more general concept (instead of doing X itself, a class relies on some other class to do it) DI is IoC as applied to dependent classes (instead of creating a class that I depend on, it will be passed to me). DI is the most common use of IoC, so usually when they are discussed the terms are used interchangeably.
The Factory Pattern's main concern is creating things - DI's main concern is how things are connected together.
In practice, these two concerns (creating and connecting) are usually related, so most DI/IoC containers do both. You could think of most implementations as very configurable factories - but because the implementations address both concerns - not because the Factory pattern and DI/IoC are the same.
- Difference IoC container and Factory pattern
- Understanding and Implementing Factory Pattern in C++
- The difference between web container and web server
- the difference between state and strategy design pattern
- Difference between / and /* in servlet mapping url pattern
- Introduction to the Spring IoC container and beans
- Factory Pattern
- Factory Pattern
- Factory Pattern
- Factory Pattern
- Factory Pattern
- Factory Pattern
- Factory Pattern
- Factory Pattern
- Factory Pattern
- Factory Pattern
- Factory pattern
- Factory Pattern
- ubuntu下实现apache的负载均衡
- 连续存储数组的算法
- Mozilla 发布多人 HTML5 游戏 BrowserQuest 及源码
- 在线音乐播放器
- Java高新技术 【9 】 JDK1.5 泛型
- Difference IoC container and Factory pattern
- error: ISO C++ forbids declaration of ‘XXXX’ with no type
- javascript时间函数
- 解决 a different object with the same identifier value was already associated with the session
- PHP中 HTTP_HOST 和 SERVER_NAME 的区别
- java中synchronized用法
- java杂记
- 算法导论-VLSI芯片测试问题
- oracle SQL数组 笔记