Difficulty 1

Factory Pattern or Factory Method Pattern


Define an interface or abstract class for creating an object but let the subclasses decide which class to instantiate. In other words, subclasses are responsible to create the instance of the class.

When to use:
– the implementation of an interface or an abstract class is expected to change frequently
– a class cannot anticipate the type of objects it needs to create beforehand

Last update 22.09.2019.
For possible mistakes in content or typos, I apologise and kindly ask you to report here.