Pola Factory nyedhiake cara kanggo nggawe obyek tanpa nggasakake kelas sing tepat — method utawa kelas sing nangani pembuatan obyek, mutusake jenis endi sing bakal dibuat. Iki nentralisir lan ngabstraksi pembuatan obyek, mudhun-mudhun kode saka kelas konret.
Apa sing didadekake pola Factory
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
