title: Dependency Injection vs Factory Pattern
body: <p>Most of the examples quoted for usage of Dependency Injection, we can solve using the factory pattern as well. Looks like when it comes to usage/design the difference between dependency injection and factory is blurred or thin.</p>
  
  <p>Once someone told me that its how you use it that makes a difference! </p>
  
  <p>I once used <a href="http://structuremap.sourceforge.net/Default.htm" rel="noreferrer">StructureMap</a> a DI container to solve a problem, later on I redesigned it to work with a simple factory and removed references to StructureMap.</p>
  
  <p>Can anyone tell me what is the difference between them and where to use what, whats the best practice here?</p>