GoF-Factory Method Pattern
Details
- Full Name
-
GoF Factory Method Pattern (Creational)
- Also known as
-
Virtual Constructor
Intent:
Define an interface for creating an object, but let subclasses decide which class to instantiate.
When to Use:
-
When a class can’t anticipate the class of objects it must create
-
When a class wants its subclasses to specify the objects it creates
Prompt Example:
"Extrahiere die Objekterzeugung in eine Factory Method nach GoF, damit neue Typen ohne Änderung des bestehenden Codes hinzugefügt werden können."
Related Anchors:
-
GoF Design Patterns (Umbrella)