What is Dependency Injection?

      Comments Off on What is Dependency Injection?

“On his blog”:http://fabien.potencier.org/article/11/what-is-dependency-injection Fabien Potencier has described in a simple manner with excellent examples, just exactly what “Dependency Injection”:http://fabien.potencier.org/article/11/what-is-dependency-injection is, and how to use it within PHP to good effect.

bq. Dependency Injection is probably one of the most dead simple design pattern I know. And odds are you have probably already used Dependency Injection. But it is also one of the most difficult one to explain well. I think it is partly due to the nonsense examples used in most introductions to Dependency Injection. I have tried to come up with examples that fits the PHP world better. As PHP is a language mainly used for web development, let’s take a simple Web example.

UPDATE: He also released the “second installment”:http://fabien.potencier.org/article/12/do-you-need-a-dependency-injection-container of this series, discussing whether you need a “Dependency Injection Container”:http://fabien.potencier.org/article/12/do-you-need-a-dependency-injection-container As well as the 3rd on the “Symphony Container”:http://fabien.potencier.org/article/13/introduction-to-the-symfony-service-container that he is using.