News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Till Klampaeckel's Blog:
Dependency Injection Containers
May 31, 2011 @ 12:29:51

Till Klampaeckel has a new post to his blog looking dependency injection containers for PHP and some of the concepts that come with them. No specific tools are advocated, but it's a good introduction to DI if you haven't had much exposure (and his view on why you may not want to use it).

I got into a discussion on Twitter the other day where I mentioned that I don't like DI. Call it lack of sleep or language barrier (on my part), but I said DI - dependency injection - when I meant the dependency injection container. Having said this, let me explain why I don't like it.

He talks about all of the hype surrounding dependency injection right now and some of the more realistic questions to ask before you think about using this approach. He sees DI containers as more extra overhead that an application might not even need. He compares it to using a "registry" and talks about some of the downsides such as:

  • Moving away the obvious dependencies from an object makes applications complicated, harder to understand
  • Convention over configuration usually clashes with the approach DI containers advocate.
  • Missing support in IDEs.
  • Inline code documentation - people don't even get __call() etc. right.
0 comments voice your opinion now!
dependency injection opinion development


blog comments powered by Disqus

Similar Posts

Engine Yard Blog: PHP Mentoring and the Importance of the Software Apprenticeship

Jani Hartikainen's Blog: 5 ways how PHP is better than Node.js

Keith Casey's Blog: The First Rule for Software Development

Slava Vishnyakov: PHP the Nice Way (Ever-evolving Huge Retailer Website Story)

Job Posting: Kavi Seeks Product Development Engineer (Portland, OR)


Community Events





Don't see your event here?
Let us know!


symfony tips podcast community zendserver bugfix voicesoftheelephpant code conference series api interview threedevsandamaybe laravel list introduction deployment framework release language

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework