Inversion of Control Flashcards
What is inversion of control?
Having an external framework manage the flow of control in your program and have your code plug into this call back function idea.
What is dependency inject a form of?
A form of inversion control
What are dependency injections?
Stating the dependencies of a class from outside rather than created within the class itself. Separate out the concerns of construction and use of objects. (single responsibility code)
What is the dependency injection technique/pattern?
Pattern whereby an object can ‘request’ instances of objects it depends upon.
Your code specifies which abstract/virtual classes it wants filled by objects by an injector. In other words you say which interfaces you want concrete implementations of and the injector will provide you with an instance.
What rules does the inject hold?
The rules for each instance:
- How it should hand out instances of interfaces
- Responsible for which concrete classes should be used for each interface.
- Responsible for instantiation.
What do dependency injections allow us to do?
Allows us to separate our concerns so objects do not manage their own lifecycle.