The term dependency injection sounds fancy but it is a really simple programming technique. Its aim is to improve testability and reusability of your code and decouple your classes. The main idea is that a class should not be creating or getting its own dependencies (other classes it depends on) but it should receive them from other classes. I will teach you about the 3 ways to achieve dependency injection (using constructor, setter function, and interface). I will also explain and show you how to implement the dependency inversion principle.
Project Files - https://github.com/Freedom-Coding/Dep...
👍 Like and 🔔Subscribe for More Unity and C# Tutorials / @freedomcoding
🌟 Support My Work and Unlock Exclusive Content! 🌟
👉 Patreon: / freedomcoding
🎮 Join Our Developer Community!
💬 Discord: / discord
💖 Support Me Financially
☕ PayPal: [email protected]
Website - https://www.freedom-coding.com
Timestamps:
00:00 What is Dependency Injection?
00:19 Example Overview
01:13 Dependency
01:41 Injection
01:57 Constructor Injection
04:44 Setter Function Injection
05:32 Interface Injection
06:29 Dependency Inversion Principle
07:34 Result And Benefits