Created
October 12, 2017 13:31
-
-
Save dasibre/ecfab11effde9b26b4a1ca9539e29fa2 to your computer and use it in GitHub Desktop.
Dependency injection dos and donts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Dependency injection is effective in these situations: | |
| You need to inject configuration data into one or more components. | |
| You need to inject the same dependency into multiple components. | |
| You need to inject different implementations of the same dependency. | |
| You need to inject the same implementation in different configurations. | |
| You need some of the services provided by the container. | |
| Dependency injection is not effective if: | |
| You will never need a different implementation. | |
| You will never need a different configuration. | |
| If you know you will never change the implementation or configuration of some dependency, there is no benefit in using dependency injection. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment