3 ms·
Curious about the use of Dependency Injection here. I'm a Python guy and it rarely gets mentioned in my world as far as I'm aware. I always assumed it was mostl
by andybak 9y ago
Curious about the use of Dependency Injection here. I'm a Python guy and it rarely gets mentioned in my world as far as I'm aware. I always assumed it was mostly an artefact of static type systems.
Can anyone share their insight? Either in the context of Python or PHP.
- RhodesianHunter 9y agoHow well are your codebases unit tested? I shiver thinking about trying to add good tests to a project in any language without good di/ioc.
- bramblerose 9y agoThe dynamicness of languages like Python make it relatively easy to do so. For example, it's difficult in Java to mock an http request if you can't inject a `HttpRequestor` (or so) to the object you're testing. In Python, it is common practice to patch objects, which means that even though the code calls `requests.get()`, the call will actually be patched through to a mock. (in the Java world, this is possible with e.g. PowerMock, but generally frowned upon)