3 ms·
When besides mocking would you want to swap out a dependency using an overarching dependency provider rather than an intermediary processor/getter with conditio
by twberger 11y ago
When besides mocking would you want to swap out a dependency using an overarching dependency provider rather than an intermediary processor/getter with conditional delegation?
- tadfisher 11y agoTest/dev environments are something else I can think of. For example, you might want a different dependency in a dev environment, but you don't want to write tedious "if (env == dev) return foo else return bar" code in your getter, which also couples the hosting class to the environment in which it's running.