Wzorzec Factory provides a way to create objects without specifying their exact class — a method or class that handles object creation, deciding which type to instantiate. It centralizes and abstracts object creation, decoupling code from concrete classes.
Czym zajmuje się wzorzec 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
