Modelat krijues merren me krijimin e objekteve — si objektet krijohen, bëhen fleksibël dhe shkëputen nga kodi që i përdor. Ato përfshijnë Singleton, Factory, Builder, Prototype dhe Abstract Factory.
Çfarë përmbushën modelat krijues
CREATIONAL patterns abstract and control HOW objects are CREATED:
→ instead of directly calling constructors everywhere (rigid, coupled), creational
patterns make object creation flexible, decoupled, and manageable
→ they help create objects in a way suited to the situation, decoupled from concrete classes
Modelat kryesorë krijues
SINGLETON → ensure only ONE instance of a class (single shared object)
FACTORY METHOD → create objects without specifying the exact class (defer to a method/subclass)
ABSTRACT FACTORY → create FAMILIES of related objects (without specifying concrete classes)
BUILDER → construct complex objects step-by-step (separate construction from representation);
good for objects with many optional parts/parameters
PROTOTYPE → create new objects by CLONING an existing one (copy a prototype)
