1. What is dependency injection?
During this chapter, I defined dependency injection as coding in such a way that those resources (that is, functions or structs) we depend on are abstractions.
We went on to say that because these dependencies are abstract, changes to them do not necessitate changes to our code. The fancy word for this is decoupling.
For me, decoupling is really the essential attribute and goal here. When objects are decoupled, they are just easier to work with. Easier to extend, refactor, reuse, and test. While these are all fantastically important, I also try to be pragmatic. In the end, the software will work just the same if it is not decoupled and does not use dependency injection. But it will become progressively harder to work with and extend.
2. What are the four highlighted advantages of dependency injection?
- Dependency...