I can\'t seem to get my head around what advantages the strategy pattern offer. See the example below.
//Implementation without the strategy pattern
class Regist
Strategy pattern helps in abstracting out the algorithmic approach for doing some particular work. Suppose you want to sort an array of numbers via different algorithms, In this case it is better to apply a strategy pattern than to tightly couple the algorithm with your code.
In the class where you are instantiating the class composed of strategy you instantiate the strategy class reference by passing it to the constructor of composed class.
This way you we are programming to an interface and not implementation and therefore at any point of time we can add more classes to the hierarchy of strategy class and pass the same to the class composed of strategy
Kindly go through the following link