Please see my other Design Pattern articles.
Providing flexibility into the domain by abstracting implementation.
Using abstraction between concrete and class implementation, avoid tightly-coupled classes, which leads to changes in once class to ripple throughout your application.
One method of doing this is the Inversion of Control design pattern which allows the class calling the behavior to be ignorant of its details, or, “loosely-coupled.”
To illustrate this pattern, I’ll begin with the abstraction – an interface through which my class will interact to call Pay().
This interface is where I’ll define just the signature of the behavior I wish to use, but I won’t provide the implementation.
Now I’ll provide the implementation of Pay(). However, remember that my class which will use this behavior won’t interact with this classes directly.
With wrapper of abstraction completed, I will now use the behavior.