intermediateDesign Patterns

What is the Prototype pattern? When would you use it over calling a constructor directly?

The Prototype pattern creates new objects by cloning an existing, fully-configured instance (via a clone() method) rather than building one from scratch through a constructor. It's useful when object creation is expensive (e.g. involves a database call or heavy computation) or when you need many variants of a complex, pre-configured object — cloning a template is far cheaper than reconstructing it field-by-field each time.

This is a Pro question

Sign in, then upgrade to Pro or Power to unlock this question and the full Interview Prep bank.

What is the Prototype pattern? When would you use it over calling a constructor directly?

Next Step

Continue to What is the Facade pattern? How does it differ from Adapter?← Back to all Design Patterns & LLD questions