What is Prototype Design Pattern?
- The word “Prototype” itself conveys that real object is accessed with the help of virtual object.
- For example, to build a house, you’ll need a prototype design first. So, it falls under the Creational Design Pattern as it plays its role by creating the new objects.
- The main feature of Prototype Design Pattern is that it creates objects by cloning or copying.
Table of Contents
Book definition of Prototype Design Pattern
Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.
Real-time Examples of Prototype Design Pattern
Example 1:
Example 2:
When to use Prototype Design Pattern?
- When the object creation is a costly operation.
Example: An Object is to be created after reading data from a database. Reading data from the database is a costly operation.
Advantages of Prototype Design Pattern
If your application needs an N number of objects of the same type, then you’ll need to create the object for the first time, and you can copy or clone that object for the number of required times. So by using this pattern, you can save time, memory and computational power.
Tutorial Videos of Prototype Design Pattern
- Prototype Design Pattern Video in English.
- Prototype Design Pattern Video Java Implementation in English.
- Prototype Design Pattern Video in Tamil.
- Prototype Design Pattern Video Java Implementation in Tamil.
- Prototype Design Pattern Video in Telugu.
- Prototype Design Pattern Video Java Implementation in Telugu.
Leave a Reply