samedi 14 décembre 2019

What does the `binding` mean in the context of the DI pattern?

What does the binding mean in the context of the DI pattern?

I am going through the IoC tutorial over here. And I come across the following excerpt:

Dependency Injection (DI) is a design pattern used to implement IoC. It allows the creation of dependent objects outside of a class and provides those objects to a class through different ways. Using DI, we move the creation and binding of the dependent objects outside of the class that depends on them.

I can not understand what binding is referred to here?

I guess that the binding referred to here is about setting the client class field. But in such a case we are not moving such a binding with the DI. Because, there are three ways to use the DI: constructor, property (setter) and method. And all of those ways do not move the binding (the assignment of the client class field) outside of the class, all of them happen in the scope of the client class. So, I am confused here.

Aucun commentaire:

Enregistrer un commentaire