hai.haus
Browse

Factory Method (software design)


A factory method, commonly referred to as simply a factory, is a design pattern which produces objects, just as a real life factory would produce goods. It is used to avoid directly specifying the class of an object during creation – which would restrict the object to the implementation of that class. Utilizing factories would allow subclasses to change how objects are created, redefining the class that is instantiated.