Het Factory-patroon biedt een manier om objecten te maken zonder hun exacte klasse op te geven — een methode of klasse die object creatie afhandelt en beslist welk type geïnstantieerd moet worden. Het centraliseert en abstraheert object creatie, waarbij code wordt ontkoppeld van concrete klassen.
Wat het Factory-patroon doet
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
