Das Factory-Pattern bietet eine Möglichkeit, Objekte zu erstellen, ohne ihre exakte Klasse anzugeben — eine Methode oder Klasse, die die Objekterstellung handhabt und entscheidet, welcher Typ instantiiert werden soll. Es zentralisiert und abstrahiert die Objekterstellung und entkoppelt Code von konkreten Klassen.
Was das Factory-Pattern bewirkt
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
