Search code examples
clean-architecturedependency-inversion

Trying to understand Figure 14.11 of the book "Clean Architecture"


enter image description here

This is from chapter 14 of the book "Clean Architecture"

It's trying to break the direct dependency of Stable-->Flexible by introducing UServer.

So that we can have Stable-->UServer<--Flexible where nobody would depend directly on the concrete class c.

But in figure 14.11, who will instantiate c?

It can not be Stable, that will introduce Stable-->Flexible back.

It can not be UServer, that will give you bi-directional dependency.

It can not be Flexible itself, because that will still force Stable to call Flexible.

So it has to be something that not in figure 14.11, right? Like some sort of dependency injection framework?

Is the author implicitly expressing that?


Solution

  • What you are looking for is the "Main Component". According to Uncle Bob this is the place where all the "ugly details" go to, where all the wiring and dependency injection goes to. See chapter 26