Conceptual
Login

Python Factory Pattern Separates Object Creation From Use

The Factory pattern, a creational design pattern from the Gang of Four catalog, separates object creation from object use by delegating instantiation to a dedicated factory abstraction rather than having client code construct concrete instances directly. Concrete factory subclasses encapsulate the choice of which concrete implementations to instantiate, so client code depends only on an abstract product interface and an abstract factory interface, not on the concrete classes being produced. This belongs to the domain of object-oriented software design, specifically creational patterns and the associated principles of cohesion and coupling.