title: Inversion Of Control vs Dependency Injection with selected quotes – is my understanding correct?
body: <p>I've read a number of threads explaining the difference between <strong>IoC</strong> and <strong>DI</strong> and while many of explanations contradicted each other, I think they still  helped me understand the difference.</p>
  <p>So here I'd like to ask whether my understanding is correct and also post excerpts that helped me ( though some of them contradict each other ).</p>
  <p>I know there have been lots of threads done on the subject, but I'm hoping this thread won't get closed since I don't think any of OPs in mentioned threads also showed all the relevant posts ( from various threads ) that helped them finally understand it.</p>
  <p>Anyways, here is how I understand it (if possible,please address/answer each question individually ):</p>
  <p>a) When we apply <strong>DIP</strong> principle at the <em>framework level</em>, then we use the term <strong>IoC</strong>? And one of the mechanisms to implement <strong>DIP</strong> at <em>framework level</em> is <strong>DI</strong>?</p>
  <p>b) The term <strong>IoC</strong> does not apply when we implement <strong>DIP</strong> ( using <strong>DI</strong> ) at a <em>lower level/non-framework level</em>, in which case we simply call it <strong>DI</strong>?</p>
  <p>c) <strong>DI</strong> helps us to achive <strong>DIP</strong> by passing the control of the actual creation of and selection of dependencies to a 3rd party which is neutral to either of the other 2 involved?</p>
  <p>d) When <strong>DIP</strong> is applied ( using <strong>DI</strong> ) at <em>framework level</em> (IoC), then three types of control get inverted:</p>
  <ol>
  <li><p><strong>The control of the interface.</strong> Now high level module is controlling the interface that the lower level modules need to adhere to instead of the other way around</p>
  </li>
  <li><p><strong>The control of the flow.</strong> --&gt; Now <em>framework code</em> ( instead of <em>user/business code</em> ) controls the flow of the program ( in other words - <em>they ( ie framework ) call you ( ie business code )</em>  )</p>
  </li>
  <li><p><strong>The control of dependency creation</strong>. This inversion is passing the control of the actual creation and selection of dependencies to a 3rd party which is neutral to either of the other 2 involved.</p>
  </li>
  </ol>
  <p>e) When <strong>DIP</strong> is applied (using <strong>DI</strong>) at <em>non-framework level</em>, then two types of control get inverted:</p>
  <ol>
  <li><p><strong>The control of the interface.</strong> Now high level module is controlling the interface that the lower level modules need to adhere to instead of the other way around</p>
  </li>
  <li><p><strong>The control of dependency creation</strong>. This inversion is passing the control of the actual creation and selection of dependencies to a 3rd party which is neutral to either of the other 2 involved.</p>
  </li>
  </ol>
  <p>?</p>
  <p>Here are excerpts that helped:</p>
  <p><a href="https://stackoverflow.com/questions/7327822/why-so-many-terms-to-say-the-same-thing-ioc-and-dip">Why so many terms to say the same thing? IoC and DIP</a></p>
  <blockquote>
  <p>Inversion of Control is the generic term. Dependency Injection is a
  specific type of IoC</p>
  <p>...</p>
  <p>Inversion of Control is when the framework/infrastructure invokes
  application code, rather than the other way around</p>
  <p>...</p>
  <p>can do DI without doing IoC. If you inject aConsoleStringWriter into a
  HelloWorld I don't really think of this as IoC because there is no
  &quot;framework&quot; or &quot;infrastructure&quot;.</p>
  </blockquote>
  <p><a href="https://stackoverflow.com/questions/3226605/inversion-of-control-dependency-injection">Inversion of Control &lt; Dependency Injection</a></p>
  <blockquote>
  <p>If you accept Fowler's definition, Inversion of Control is a much
  broader term than DI that covers allframework usage where you plug
  into a framework, but the framework is still in control. Dependency
  Injection is a specialization of IoC that applies IoC specifically to
  manage dependencies.</p>
  </blockquote>
  <p><a href="https://stackoverflow.com/questions/4596300/where-exactly-is-the-difference-between-ioc-and-di">Where exactly is the difference between IoC and DI</a></p>
  <blockquote>
  <p>IoC is the ability to vary the implementation of a contract. DI is the
  ability to supply the implementation.</p>
  <p>...</p>
  <p>In traditional applications, developers would write business code and
  framework code. The business code would then call the framework code
  to accomplish tasks. Under an IoC model, you &quot;invert&quot; that model and
  create a framework that accepts business modules and calls them to
  accomplish tasks</p>
  <p>Dependency Injection is a technique (hard to call it a pattern,
  really) of removing internal dependencies from implementations by
  allowing dependent objects to be injected into the class/method by an
  external caller. IoC frameworks use dependency injection to supply
  user modules and other dependent code to framework routines that &quot;glue
  it all together.&quot; Dependency injection is used heavily by IoC
  frameworks because that is the mechanism that allows them to &quot;Call
  You.&quot;</p>
  </blockquote>
  <p><a href="https://stackoverflow.com/questions/6766056/dip-vs-di-vs-ioc">DIP vs. DI vs. IoC</a></p>
  <blockquote>
  <p>DIP is the principle that guides us towards DI. Basically, loose
  coupling is the goal, and there are at least two ways to achieve it.
  • Dependency Injection •  Service Locator</p>
  </blockquote>
  <p><a href="https://stackoverflow.com/questions/424457/does-anyone-have-a-good-analogy-for-dependency-injection">Does anyone have a good analogy for dependency injection?</a></p>
  <blockquote>
  <p>The essence of Inversion of Control (of which Dependency Injection is
  an implementation) is the separation of the use of an object from the
  management thereof.</p>
  </blockquote>
  <p><a href="https://stackoverflow.com/questions/3402720/difference-between-ioc-and-dependency-injection">Difference between ioc and dependency injection</a></p>
  <blockquote>
  <p>The terms Dependency Injection (DI) &amp; Inversion of Control (IoC) are
  generally used interchangeably to describe the same design pattern
  (although not everyone agrees on that point, and some people tend to
  apply them in slightly different ways). The pattern was originally
  called IoC, but Martin Fowler proposed the shift to DI because all
  frameworks invert control in some way and he wanted to be more
  specific about which aspect of control was being inverted.</p>
  </blockquote>
  <p><a href="https://stackoverflow.com/questions/6550700/inversion-of-control-vs-dependency-injection">Inversion of Control vs Dependency Injection</a></p>
  <blockquote>
  <p>Inversion of Control (IoC) means that objects do not create other
  objects on which they rely to do their work. Instead, they get the
  objects that they need from an outside source (for example, an xml
  configuration file). Dependency Injection (DI) means that this is done
  without the object intervention, usually by a framework component that
  passes constructor parameters and set properties.</p>
  </blockquote>
  <p>thank you</p>