interface UIComponent {
   
void validate();
}

interface TouchUIComponent extends UIComponent {
   
void touch(String event);
   
void swipe(String event);
}

interface NonTouchUIComponent extends UIComponent {
   
void mouseover(String event);
}

 

 

 

 

It will not create dependencies inside the calling class.

It will ask a builder or framework for the dependencies

and that builder will create the object and provide the instance to the caller

We have to decouple the creational activity previously it was tightly coupled.