Tag

dependency-injection-in-.net

The Transient Lifestyle

From Dependency Injection, Principles, Practices, and Patterns by Steven van Deursen and Mark Seemann

This articles explains the Transient Lifestyle: what it is and when you might want to use it.

The Singleton Lifestyle

From Dependency Injection, Principles, Practices, and Patterns by Steven van Deursen and Mark Seemann

This articles explains the Singleton Lifestyle: what it is and what it means for your code.

The Ambient Context Anti-Pattern

From Dependency Injection, Principles, Practices, and Patterns by Steven van Deursen and Mark Seemann

This article explores the Ambient Context DI anti-pattern: what it is, how to identify it, and why it’s so dangerous.

The Service Locator Anti-Pattern

From Dependency Injection, Principles, Practices, and Patterns by Steven van Deursen and Mark Seemann

This articles explains the Service Locator anti-pattern: what it is, what effects it has on code, and why it’s a problem.

Understanding Method Injection

From Dependency Injection, Principles, Practices, and Patterns by Steven van Deursen and Mark Seemann

This article delves into the Method Injection DI Pattern: how it works, and when and why you might want to use it.

Understanding Constructor Injection

From Dependency Injection, Principles, Practices, and Patterns by Steven van Deursen and Mark Seemann

This article delves into the Constructor Injection DI pattern—what it is and how, when, and why to use it.

Abuse of Abstract Factories

From Dependency Injection Principles, Practices, and Patterns by Steven van Deursen

This article discusses why Abstract Factories shouldn’t be used to create stateful Dependencies with a short lifestyle and why it’s generally better not to use Abstract Factories to select Dependencies based on runtime data.

Understanding the Composition Root

From Dependency Injection Principles, Practices, and Patterns by Steven van Deursen and Mark Seemann

This article describes where and how programmers should compose an application’s object graphs and the concept of the Composition Root.

Writing Maintainable, Loosely-Coupled Code

From Dependency Injection Principles, Practices, and Patterns by Steven van Deursen and Mark Seemann

What purpose does DI serve? DI isn’t a goal in and of itself, rather a means to an end. Ultimately, the purpose of most programming techniques is to deliver working software as efficiently as possible. One aspect of that is to write maintainable code. This article discusses what DI is (and is not).

© 2023 Manning — Design Credits