lundi 19 août 2019

How is OCP (Open closed principle) related to IoC (Inversion of Control)?

One example i can think of is Template Pattern which is a way of doing IoC is also an example of OCP. Because in template pattern we define the base algorithm which cannot be changed by child classes but can override the inherited step methods of that algorithm. So in future if we want to change the implementation of a step we can create another child class and implement those steps.

Is there any other example of this as well ?

Aucun commentaire:

Enregistrer un commentaire