3 ms·
> Even if a dependency is injected, if it has state, and all parts of the program could potentially access it, I would consider it global mutable state. Not al
by lmm 9y ago
> Even if a dependency is injected, if it has state, and all parts of the program could potentially access it, I would consider it global mutable state.
Not all parts of the program could potentially access it - it's injected where it's needed but only where it's needed, if other parts of the program wanted access to it you would have to change them so that it was injected there as well.
- sago 9y agos/injected/imported It makes little substantive difference whether the import is in code or in a separate declaration. Little substantive difference to whether the state is global and mutable, that is. Don't misunderstand me as claiming dependency injection is pointless.