3 ms·
Yes, they are supposed to. The problem is that it gets taken to extremes when it's done at the framework level. The pattern tends to encourage overly decouple
by lugg 7y ago
Yes, they are supposed to.
The problem is that it gets taken to extremes when it's done at the framework level.
The pattern tends to encourage overly decoupled abstractions that are nigh impossible to wrap your head around.
Dependency injection is useful when you need to decouple for testing. Other than that it's rarely useful.
If your trying to decouple everything because "coupling is bad mmkay" your just cargo culting.
IOC is just anti OO. And I'm anti OO. But when you use IOC for every class yove got a huge fucking problem.
The only time I've seen IOC work well is across module boundaries in a system where modules were boundaries that could not be crossed without the IOC.
Within modules usual namespacing and new constructors were used liberally.