How to select between Strategy Pattern and Factory Pattern?

  Kiến thức lập trình

When I am going through the design patterns I got confused between the Strategy Pattern and Factory Pattern selection. Even though one is behavioral pattern and later is creational pattern but requirement can be achieved by any one of it. Like single interface has been extended by multiple concrete classes and selection of concrete implementation takes place during run time.

But I am confused in what scenarios which one should be used.
When I tried to understand from AIs available only point highlighted was strategy has more granular control.

Could some one help me understand more practical scenarios and how to choose between them in different scenarios.

LEAVE A COMMENT