Spring, DIP, dependency inversin, dependency injection
来源:互联网 发布:mac花屏两秒自动恢复 编辑:程序博客网 时间:2024/06/05 10:02
http://www.springbyexample.org/static/1.3/html/core-concepts.html
Dependency Inversion: Precursor to Dependency Injection
The first reference to what would eventually become Dependency Injectionappeared in 1994 in a paper by Robert C. Martin called “The Dependency Inversion Principle”.
In “The Dependency Inversion Principle” (or DIP), the author states the three defining factors of “bad code”:
- It is hard to change because every change affects too many other parts of the system (Rigidity)
- When you make a change, unexpected parts of the system break (Fragility)
- It is hard to reuse in another application because it cannot be disentangled from the current application (Immobility) [3]
According to Martin, interdependency causes these coding problems (we'll call them RFI for Rigidity, Fragility, and Immobility). To fix RFI issues in your OO code, DIP has two basic rules:
1. High level modules should not depend upon low level modules, both should depend upon abstractions.
In other words, high level modules – which contain your business logic and all of the important meat of your application – should not depend on lower level components. The reason for this is if these lower level components were to change, the changes might affect the higher level components as well. This is the defining concept behind dependency inversion, that the prevailing wisdom of having higher-level modules dependent on lower-level modules is in fact a bad idea.
2. Abstractions should not depend upon details, details should depend upon abstractions.
This is another way to say that before you begin coding to the abstraction – the interface or abstract class -- you should find the common behaviors in the code and work backwards. Your interface /abstraction should cater to the intersection between the needs of your business logic and the common behaviors of the lower level modules. You should also leave the details of how these behaviors are implemented to the implementation classes.
- Spring, DIP, dependency inversin, dependency injection
- Spring 3 Dependency injection
- Spring Dependency Injection (DI)
- Spring Dependency Injection (DI)
- Spring依赖注入(dependency injection)
- Dependency Injection
- Dependency Injection
- Dependency Injection
- Dependency Injection
- Spring(2)-Spring Dependency Injection (DI)
- Spring IoC容器和Dependency Injection模式
- 超简单Spring入门(一)Dependency Injection
- spring ,ioc ,dependency injection 的设计模式
- 小菜鸟学 Spring-Dependency injection(二)
- spring 随笔(一) bean & Dependency Injection
- spring依赖注入(dependency injection)
- A curry of Dependency Inversion Principle (DIP), Inversion of Control (IoC), Dependency Injection (D
- IOC和Dependency Injection
- Linux进程通信——管道
- Linux修改服务器时间
- string与string.h区别
- MyEclipse项目,使用自带Git插件,添加Git支持(SSH方式)
- SecureCRT鼠标左键划选后变成回车问题解决
- Spring, DIP, dependency inversin, dependency injection
- 在线安装eclipse中html/jsp/xml editor插件(非常可靠)
- xrdp 访问 ubuntu 12.10 只看到背景,看不到菜单栏的解决办法
- cacti计费系统主备同步
- MyEclipse性能调优初体验
- 几款极好的 JavaScript 文件上传插件
- sql server的表结构发生变化后,需要调用exec sp_refreshview 视图名来更新视图
- leetcode - Climbing Stairs
- 上个厕所。