Dependency Injection Explained

Published: 21 June 2022
on channel: Train To Code
285
12

Dependency injection is used in object oriented languages such as Java and C# to isolate pieces of functionality and allow you to swap them out. This helps with unit testing and high level configuration without having to modify the business logic in your code.

In this video I'll explain what dependency injection is and how it works, with an example in C#. We will also touch on the wider concept of Inversion of Control, to which Dependency Injection contributes.

00:00 Introduction
00:22 What Is Dependency Injection
00:59 Code Example
03:36 Abstractions
05:22 Using Dependencies
07:43 DI Containers
10:40 Conclusion