dependencies icon indicating copy to clipboard operation
dependencies copied to clipboard

Python does not need DI because mocks.

Open proofit404 opened this issue 6 years ago • 0 comments

Dependency injection is all about composition. Would you use global mocks in the production code?

it is not for mocking, it is for isolation with composition

DI is not for testing. It is great for structuring code the right way. Easier code reuse and refactoring. It is for production, not testing.

Include in the FAQ section.


The reason to move from direct imports & calls is the same programmers in Java and C# moves from static methods and utility classes.

You'll ends up with mocks returning mocks returning mocks just to test a + b.

proofit404 avatar Jul 01 '19 01:07 proofit404