3 ms·
It wouldn't. It is for when you want to swap out that library, or test business logic using that library beyond simple unit tests. DI is also great for creatin
by JBReefer 9y ago
It wouldn't. It is for when you want to swap out that library, or test business logic using that library beyond simple unit tests.
DI is also great for creating modular code you compose, instead of monoliths. It encourages the use of interfaces and information hiding - you should look into it, it's a very powerful technique.
Instead of asking how it would improve an arbitrary library, ask yourself "how screwed am I if 100% of the API surface for this library changes tomorrow?" Dependency injection would help you out of that faster that rewriting everything.