Thursday, August 13, 2009

Inversion of control and dependency injection

The caller eventually get the results, but how and when is out of its control. The callee decide when and how. This is a technique separating execution of a certain task from its implementation.

1. decoupling execution and its implementation
2. Every system focus on what it is designed for.
3. Every system does not what other system will do or should do.
4. Changing one system will not affect others.

Techniques:

1. Factory pattern.
2. setter injection
3. Constructor injection.
4. Services Locater
5. Interface injection

Dependency Injection is decoupling high level modules from low level services.

No comments:

Post a Comment