When to use Dependency Injection -


I feel certain that dependency-injection really can not be "I can not really say my "I know it may seem silly, but in fact it is about the argument that why should I use dependency injection (DI)?" It is often said that I should use DI to achieve high level of loose coupling, and I get that part. But in reality ... how often do I change my database, when my choice falls on MS SQL or MySQL .. Very few right?

Does anyone have some very attractive reasons because this is the way

Two words, unit tests .

One of the most attractive reasons for D is that it is easy to allow unit testing to hit one unit and not to worry about setting up 'test' data.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -