EnriqueMark
Design Patterns & Architecture

DI

2026-03 English

The core of DI is defining structure, and there are generally two ways to do that interface abstract class

The key thing is that the DI container has to know the structure of the object it handles before it can do anything further with it, and these two are both normally used to define structure. Or rather, more than structure, it’s the operational type that matters. A type is a declaration about structure. The core of it is that I need to know what you look like before I can operate on you, and what you look like is what the type is there to tell apart.

More detail in Dependency injection


Translation note. I wrote this in Chinese. This English version is an LLM translation, so the wording is not mine even though the thinking is. Original: DI.