3 ms·
Even in Python, you benefit from structuring an object to accept its dependencies as inputs, rather than calling to them by their global names. It lets you test
by JulianMorrison 16y ago
Even in Python, you benefit from structuring an object to accept its dependencies as inputs, rather than calling to them by their global names. It lets you test each class independently with mock objects that support the same interface.
- andybak 16y agoBy writing XML config files? (or is that just a Struts wart rather than an intrinsic part of DI?) Anyway - if mocking for tests is the major benefit of DI then there some other simpler ways to that. Everything I've read on DI makes it sound like a fairly complex beast.