Jeśli jesteś właścicielem tej strony, możesz wyłączyć reklamę poniżej zmieniając pakiet na PRO lub VIP w panelu naszego hostingu już od 4zł!

Charles Sprayberry’s Blog: Why you should use DI

Charles Sprayberry’s Blog: Why you should use DI

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

Source: http://www.phpdeveloper.org/news/17457

<!–
var d = new Date();
r = escape(d.getTime()*Math.random());
document.writeln('’);
//–>

Posted Styczeń 28th, 2012 in WEB and PHP Development.

Leave a response: