Demo about 24 desigin patterns with code and instances.
Define an interface for creating objects, and let the subclass decide which class to instantiate. Factory Method delays the instantiation of a class to its subclasses.
When a class doesn't know which class of the object create.
When a class wants to specify the object it creates by its subclasses.
When the class delegates the responsibility of creating an object to one of several help subclasses, and you want to localize which help subclass is the agent.