Conclusion
In this article, you learned about Dependency Injection and that classes are said to be directly dependent on each other when one class instantiates another to gain access to the target type's functionality.
To decouple a direct dependency between two types, an interface should be created. An interface allows a type to easily contain different implementations, depending on the context of the functionality needed.
By passing in the interface type to a constructor or method of class, the class/method needing the functionality does not know the details of the type implementing the interface. As such, the interface type becomes easily reusable among many different classes requesting similar but different behavior.
To practice creating dependency injection, look over some of your existing code in one or more applications and try refactoring a heavily used base type into an interface.
For the classes directly instantiating that base type, change them to use the new interface type and pass this type through the constructor or method parameter list of a class that will need to use it.
Try testing the interface type using a test implementation. After refactoring some of your code, it should become easier to implement DI and you should notice how much more flexible your application will become in terms of reusability and maintenance.