The prototype design pattern allows us to specify a category of objects using a prototype instance. This instance is then copied in order to create new objects. The prototype design pattern is ideal for situations when you want object creation to be independent of the system. For example, we might be developing a game with multiple levels. Each level is based on a core level and modified thereafter. We can clone the prototype level in order to create subsequent levels and avoid having to start level creation from scratch.
Object creation requires processing time, and reducing the time it takes to create objects is a goal of the prototype design pattern.
We will look at an example use case, the UML class diagram, and the source code that's necessary to implement the prototype design pattern for this scenario.