Soláthraíonn an patrún Factory bealach chun réada a chruthú gan a gcreathadh beachta a shonrú — modh nó rang a dhéileálann le cruthú réada, ag cinneadh cén saghas a dhéanfar instantiation air. Déanann sé cruthú réada a ionadaitheoirí agus a ionadaítear, réada a dhealú ó fhlosc-ranganna..
Cad a dhéanann patrún an Fhardóra
FACTORY → encapsulate object CREATION (instead of calling constructors directly):
→ a factory method/class decides WHICH class to instantiate and creates it
→ the caller asks the factory for an object (by type/parameter) → gets the right object
WITHOUT knowing/specifying the concrete class
→ decouples code from CONCRETE classes; centralizes creation logic
