1.Topics‎ > ‎Architecture‎ > ‎Patterns‎ > ‎a.Design Patterns‎ > ‎B.Creational Patterns‎ > ‎

D.Dependency Injection (DI)

  1. Summary 
    1. DI can be considered as special case (subset) of IOC that just guide how to satisfy object dependencies i.e. initialize Object properties at run time.
    2. It is more of a implementation (Coding) concept that design one.
    3. All the IOC frameworks support DI mechanism.
  2. Applicability
    1. There are mainly two situations when Dependency Injection is very powerful. Either by using factory or by using containers however containers are more preferred way.
  3. DI Types 
    1. Constructors
    2. Methods
    3. Properties
  4. Implementation Techniques 
    1. Dependencies can be injected by any of following mechanism
    2. Exposing Dependency Objects Property
    3. Exposing Setter Function
    4. Using Constructors
    5. Configuration Files
  5. Dependency Injection Frameworks 
    1. Spring (Java) 
    2. Spring.Net (MS dot net).
  6. Related Pattern 
    1. Strategy can use DI to load strategy at run time
  7. Related Disscussion
    1. Dependency Injection And Factory Pattern
    2. IOC Vs DI
      1. IOC guides how to achieve loose coupling at brod level and and uses some mechanism of DI to s initialize Object properties at run time
      2. http://www.martinfowler.com/articles/injection.html#InversionOfContro
      3. http://neelzone.wordpress.com/2007/04/04/injection-and-inversion/
      4. http://javavillage.in/view_topic.php?id=45