Software Architecture: Dependency Injection for C# Devs
4.2 (261 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
4,879 students enrolled

Software Architecture: Dependency Injection for C# Devs

Learn Dependency Injection techniques along with an IoC-framework (DI-Container). Grow Architecture applying DI.
4.2 (261 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
4,879 students enrolled
Created by Engineer Spock
Last updated 7/2020
English
English [Auto]
Current price: $37.99 Original price: $54.99 Discount: 31% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 5.5 hours on-demand video
  • 5 articles
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • Deeply understand the concepts of Dependency Injection and Inversion of Control
  • Apply Dependency Inversion Principle (DIP) in practice
  • Understand the concept of DI-Containers (IoC-Containers)
  • Build a trivial IoC-Container on your own
  • Apply existing IoC-Containers (frameworks)
  • Refactor your code by applying DI coming up with significantly improved Architecture
  • Write unit tests (this course includes introduction to Unit Testing)
  • Apply AOP (aspect-oriented programming) techniques
Course content
Expand all 86 lectures 05:18:29
+ Before taking the Course
5 lectures 00:46
How to Ask Questions
00:22
Introduction to Unit Testing
00:11
Download Source Code and Slides
00:03
English Subtitles
00:06
Join .NET Community of Students
00:02
+ Dependency Inversion Principle and Dependency Injection
11 lectures 44:36

The outline of the section dedicated to Dependency Inversion Principle (DIP) and Dependency Injection (DI) where you'll learn the main definitions and concepts.

Preview 01:35

Learn what is Dependency Inversion Princple (DIP) in essence.

Preview 03:30

Learn the definition of a dependency.

Dependencies
04:49

Learn the difference between volatile dependencies and stable dependencies.

Preview 02:53

Learn what is "inversion of control" and "dependency injection".

Definitions of IoC and DI
03:18

Look at an example of DIP violation on practice.

DIP Violation Demo
02:47

Look at the refactoring process based on Dependency Injection (DI) that leads to a better design of the application.

Refactoring to a Better Design Applying Dependency Injection
08:31

Learn different Dependency Injection (DI) techniques such as Constructor Injection, Property Injection and Method Injection.

Dependency Injection Techniques
07:09

Learn about the architectural implications of dependency injection.

Preview 05:24

Learn about the common smells of Dependency Inversion Principle (DIP) violation.

Common Smells of DIP Violation
02:37

A conclusion of the section dedicated to Dependency Inversion Principle (DIP) and Dependency Injection (DI). Recap what you learned.

Conclusion
02:03
+ Introduction to IoC-Containers (or DI-Containers)
6 lectures 24:33

Outline of the second section dedicated to DI-Containers (IoC-Containers).

Outline
01:07

Learn what is Pure DI and how it differs from IoC-Containers (DI-Containers).

Preview 05:01

Learn how to build your own naive implementation of a DI-Container.

Building a Simple IoC-Container
03:53

Learn what is Service Locator and how to implement it. What is the difference between a DI-Container and Service Locator?

Service Locator Design Pattern
02:54
Demo With an IoC-Container
10:21

The conclusion for the section on IoC-Containers (DI-Containers). Recap what you learned.

Conclusion
01:17
+ Dependency Injection - Related Anti-Patterns & Refactorings
10 lectures 43:23

The outline of the third section "Dependency Injection - Related Anti-Patterns & Refactorings". Learn what the most common DI-related anti-patterns exist and how to avoid them or how to remove them by applying proper refactorings.

Outline
01:54

Learn about the dependency injection anti-pattern called "Control Freak".

Control Freak
07:06

Learn about the dependency injection anti-pattern called "Hidden Dependencies" that is caused by wrong use of Service Locator design pattern.

Hidden Dependencies with Service Locator
04:41

Learn about the dependency injection anti-pattern called "Temporal Coupling" and how to avoid it by applying the constructor injection technique.

Temporal Coupling and Constructor Injection
01:47

Learn about the dependency injection anti-pattern called "Constructor Over-Injection" and how to avoid it by applying corresponding refactorings.

Preview 04:05

Learn the Ambient Context design pattern and how to applyt it to avoid the "Constructor Over-Injection" anti-pattern.

Preview 03:53

Learn what is Facade Service and how to apply it to avoid constructor over-injection,

Facade Service
02:58

Learn about the dependency injection anti-pattern called "Bastard Injection" and how to cure the decease by applying the property injection.

Property Injection VS Bastard Injection
03:34

Learn what is "cyclic dependencies" and why they are pure evil.

Cyclic Dependencies
10:50

The conclusion on the third section dedicated to DI-related anti-patterns and refactorings.

Conclusion
02:35
+ Dependency Injection Real-World Example
9 lectures 29:34

The outline of the fourth section dedicated to analysis of a real-world code example where we apply Dependency Injection to achive loosely coupled code.

Outline
01:13

An overview of an application we're going to work on.

Application Overview
01:24

Overview of the Data Access Layer.

Data Access and Models
02:00

In this lecture, I'll demonstrate you the UI-side of the sample application.

UI-Side
03:18

In this lecture, you'll learn about the problem of tight coupling that can be fixed by Dependency Injection.

The Problem of Tight Coupling
03:41

In this lecture, you'll learn how to refactor the code base towards loosely-coupled code by applying dependency injection.

Refactoring Process
10:30

Learn how to isolate the bootstrapper to adhere to the SRP (Single Responsibility Principle).

Isolating the Bootstrapper
04:20

Learn what are the consequences of refactoing we performed by applying dependency injection.

Consequences
01:54

The conclusion on the refactoring of a real-world example by applying dependency injection to achive loosely coupled code.

Conclusion
01:14
+ Reaping the Fruits of DI
4 lectures 20:27

The outline of the fifth section dedicated to harnessing the pros of loosely-coupled code achived through Dependency Injection.

Outline
00:27

In this lecture, I'll show you how to add new data access layer in a loosely-coupled code that was achieved by applying dependency injection.

Adding New DAL
08:58

In this lecture, you'll see how to write a unit test for a view model in a loosely coupled code achieved by applying dependency injection.

Writing Unit Tests for View Models
10:17

The conclusion on the section dedicated to harnessing the pros of loosely-coupled code that was achieved by applying dependency injection.

Conclusion
00:45
+ DI-Containers (IoC-Frameworks)
12 lectures 45:45

The outline of the sixth section dedicated to DI-Containers (IoC-Containers).

Outline
01:35

Learn what DI-Containers in the world of .NET platforms exist.

Overview of DI-Containers
03:46

Learn how to build a bootstrapper with a Unity DI-Containe.

Unity DI-Framework
10:17

Learn what is late binding and how to implement it with Unity.

Late Binding with Unity
05:30

Learn what is Aspect-Oriented Programmin or AOP in short.

Preview 03:49

Look at the problem of the boilerplate code that can be solved by AOP.

Demonstration of the Problem of Boilerplate Code
04:08

Learn how to apply AOP by using the power of Intercepting feature of Unity.

Preview 05:19

Learn the pros and cons of different approaches to implement AOP.

Interception vs Pure DI vs AOP Tooling
02:40

Learn how to build a bootstrapper with Autofac and Castle.Windsor DI-Containers.

Autofac and Castle.Windsor DI-Containers
04:29

Learn what the problems are related to DI-Containers.

Problems Related to DI-Containers
01:57

The conclusion on the sixth section dedicated to DI-Containers (IoC-Containers).

Conclusion
00:57
BONUS Lecture
01:18
+ Appendix. Intro to Unit Testing. Getting Started
12 lectures 45:09
Outline
00:58
What is a Unit Test
03:09
Unit Testing Frameworks
03:22
Your First Unit Test
08:43
Naming Conventions
04:34
Running and Debugging Unit Tests
05:02
Benefits of Unit Tests
03:35
Who Should Write Unit Tests and When
02:51
Programmer's Oath
03:17
Exercise: Degree Converter
01:29
Solution: Degree Converter
06:54
Conclusion
01:15
+ Appendix. Intro to Unit Testing. NUnit Framework
17 lectures 01:04:16
Outline
01:01
Assert Intro
05:29
Assert Demo
10:27
Arrange-Act-Assert
00:58
Running Tests from the Console
01:51
SetUp and TearDown
05:09
OneTimeSetUp and OneTimeTearDown
02:13
Parameterized Unit Tests
03:40
Grouping and Ignoring Unit Tests
02:14
Code Coverage
01:42
Exercise: FizzBuzz
01:07
Solution: FizzBuzz
05:05
Exercise: Parsing Roman Numerals
02:27
Solution: Parsing Roman Numerals
09:27
Exercise: Stack
00:59
Solution: Stack
09:02
Conclusion
01:25
Requirements
  • Some experience in C#
Description

Build a solid foundation in software architecture applying Dependency Injection with IoC-Containers

In many of my courses I use techniques of Dependency Injection and each time students write me private messages saying that they don't what it is and thus they don't understand what's going on in the course I teach. This is very unfortunate from the learning perspectives.

Dependency Injection is the set of techniques that allow to supply dependencies to objects. Actually, if you have ever passed dependencies via constructors, then you applied the so-called constructor injection. Dependency Injection (DI) is simple and difficult at the same time. On one hand, DI is comprised of simple techniques and on the other hand, when we need to bring DI to the next level, we need to make things more complicated using the so-called DI or IoC (Inversion of Control) Containers. These are the frameworks which perform dependency injection automatically. You just need to set one up in the application root (an extremely important notion which you'll learn about in the course) and after that, it will resolve all the dependencies it knows about in the runtime.

If you still don't understand what am I talking about, just believe me, you absolutely need to know about Dependency Injection. This course will tremendously improve your understanding of how software architectures emerge. So, this course is "must watch" for anyone who still doesn't understand what is DI and IoC-Containers.

Content and Overview

This course is aimed at all kind of developers. It provides solid theoretical base reinforced by practical material.   

The course covers:

  • Introduction to Inversion of Control:
    Dependency Inversion Principle (DIP), Inversion of Control (IoC), Dependency Injection (DI),
    Dependencies and their types, Pure DI and IoC-Containers, Service Locator

  • The Architectural Implications of Dependency Injection

  • DI-related Anti-Patterns & Refactorings: 
    Control Freak, Hidden Dependencies, Temporal Coupling,
    Constructor Over-Injection and how to avoid it,
    Ambient Context, Facade Service, Property Injection vs Bastard Injection, Cyclic Dependencies

  • Refactoring Example of an existing code base applying Dependency Injection

  • How to reap the fruits of DI

  • DI-Containers (IoC-Containers):
    Overview, Unity, Late Binding with Unity, Aspect-Oriented Programming (AOP), Interception vs Pure DI vs AOP Tools,

  • Setting up a bootstrapper with Unity, Autofac and Castle.Windsor

  • Introduction to Unit Testing

Teaching Approach

No fluff, no ranting, no beating the air. I respect your time. The course material is succinct, yet comprehensive. All the important concepts are covered. Particularly important topics are covered in-depth.

Take this course, and you will be satisfied. 

Who this course is for:
  • Any C# developer who wants to learn about Dependency Injection and IoC-Frameworks