This design pattern is called Strategy Pattern.
It is used to define a family of algorithms, encapsulates each
one, and make them interchangeable. Strategy
design pattern lets an algorithm vary independently
from clients that use it.
For example, animals can "walk" in many different w...