|
|
|
|
|
by Scarblac
110 days ago
|
|
Because code becomes harder to understand. With direct dependencies, if you are trying to understand some code that calls some function and what it does exactly isn't completely obvious, you can press a button to go to it, understand it, and come back. With dependency injection it depends on what is going to be inserted during runtime, so you can't. |
|
Hence the benefit to testing; allowing you to inject a deterministic implementation while under test.