Design Patterns (GoF) (50 Qs)•Part 3: Architectural Patterns & Enterprise Systems (25 - 35)
What is the Prototype Pattern and when should you use Cloning over constructors?
junior LevelMost AskedPrototypes
In Simple Words: The Prototype Pattern creates new objects by copying (cloning) an existing instance rather than constructing from scratch.
- Use Case: When object creation is computationally expensive (e.g. database loading, network lookups, complex calculations).