What is the Prototype design pattern?

Answer

The Prototype pattern creates new objects by copying (cloning) an existing object, called the prototype. Instead of instantiating a new object from scratch, you call a clone() method on the prototype. This is useful when object creation is expensive (e.g., loading from a database or performing heavy computation) and you need many similar objects. For example, a game that spawns many enemies of the same type can clone a prototype enemy instead of re-loading all assets for each spawn. Java's Cloneable interface and Python's copy.deepcopy() are standard implementations.