Factory Pattern
The Factory Pattern centralizes object creation so consumers depend on an abstraction instead of knowing concrete construction details. It can support OCP by allowing new product implementations to be introduced behind a stable creation boundary. However, the factory itself may still need modification unless a registry, dependency injection container or another extensible mechanism is used. Therefore, Factory supports OCP but does not automatically guarantee it.
Encapsulates object creation.
Hides concrete construction from clients.
Can centralize validation and construction rules.
Can support OCP when creation is extensible.
A large switch-based factory may itself become a maintenance hotspot.