3 ms·
>> no other language seems to collectively wring its hand about DI quite like Java does. C# is the same. I don't think DI is justify-able in many situations un
by osigurdson 4y ago
>> no other language seems to collectively wring its hand about DI quite like Java does.
C# is the same. I don't think DI is justify-able in many situations unless you intend to inject alternate, non-test versions of dependencies. If only injecting test stubs and mocks, it is important to remember that you are creating various new implementations. The stub/mock implementer needs to have a deep understanding of it and the mock also needs to behave like the real thing (which could easily diverge). The value depends on the behavioural stability of the dependency being mocked/stubbed.