2 ms·
Forget mocking, the major benefit of DI for me has always been proxies. For our multi-tiered system, this means managing caching and logging of certain calls a
by codebolt 6y ago
Forget mocking, the major benefit of DI for me has always been proxies.
For our multi-tiered system, this means managing caching and logging of certain calls and events at the level of data access. And at the service level, it means dealing with things like authorisation.
Smart use of DI sets the system up in a way were it's easy to handle these types of cross-cutting concerns where appropriate, and with minimal boilerplate. It also simplifies refactoring.