Factory
Creational
Creation of objects that conform to the same interface without specifying concrete classes
Centralize creation of different types of objects as long as they conform to the same interface. Create a separate 'factory' class, pass parameters differentiating what object needs to be created, return an object of an interface.
Recipe
- Extract interface from objects,
- Create a 'Factory' class,
- Put in a switch case or other logic to create objects of different type (but same interface) into the factory class.