Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Varying Definitions of Dependency Injection

TheJaguarTheJaguar Member Posts: 13 ✭✭

I've been programming for nearly 30 years and professionally for about 10, but dependency injection is a fairly new topic for me; probably because I'm mostly self-taught.

While researching best practices and available dependency injection libraries for Unity, I found several references to things that I would not associate with dependency injection. For example, having a factory singleton to get required objects: . Or in another case, having a library that silently injects dependencies based on config file or other startup code.

In my understanding, dependency injection is simply requiring code that instantiates and/or uses and object, etc. to supply the dependencies, rather than having the objects find/create their own. In particular, it was my understanding that dependency injection was in compete opposition to the use of singletons and globals; a thought that is contrary to the definitions referenced above.

Sign In or Register to comment.