News Feed
Sections




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

Charles Sprayberry's Blog:
Why you should use DI
January 27, 2012 @ 10:18:48

In this recent post from Charles Sprayberry he explains why using dependency injection (DI) in your application is a good idea and can help make things easier in the long run.

Dependency Injection is just a fancy term for passing dependencies to the object needing them instead of letting the object create its own. Hopefully, you've watched this great Google Clean Code talk about dependency injection by Misko Hevery where he talks about why you should ask for things instead of looking for them. I'm gonna talk about some reasons to use DI beyond just those presented in the video.

He breaks it up into a few different sections:

  • It helps in the battle against global state
  • It helps your design
  • It makes using the single responsibility principle easier
0 comments voice your opinion now!
di dependency injection opinion reasons


blog comments powered by Disqus

Similar Posts

Phil Sturgeon: T_PAAMAYIM_NEKUDOTAYIM v Sanity

Reddit.com: How do you manage many PHP projects? Lots of VMs?

Anthony Ferrara's Blog: On PSR-0 Being Included In PHP's Core

The Codist Blog: I Will Never Understand the Appeal Of PHP

Vance Lucas' Blog: NoSQL First Impressions: Object Databases Missed the Boat


Community Events





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


language laravel podcast library opinion release tips zendserver install community interview api introduction package deployment voicesoftheelephpant symfony series bugfix framework

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