|
|
|
|
|
by zzbzq
2052 days ago
|
|
I hope that's a typo because it's literally the opposite of what you're saying in #2. It is precisely when you use a DI container that the problem is hidden, whether or not it's solved. In most projects that use a DI container, the problem is usually not solved correctly, but the developers are oblivious and overconfident. They think, as you do, using a DI container means they did it right. False! The DI container only guarantees everything is hoisted up to the object constructor. This is NOT DEPENDENCY INVERSION. The objects can be in the constructor, but the dependency arrow can still point the wrong way. An obvious example of this I've seen a million times is an interface sitting right next to its only implementation. That's NOT Dependency Inversion. If you don't use a DI container, the problem also may or may not be solved, but it is never obscured, it is completely visible. |
|
Also, one can use DI without DI containers. Actually I prefer not using DI containers when possible.