Published on November 1, 2017 by kudvenkat
Want create site? Find Free WordPress Themes and plugins.

In this video we will learn
1. What is prototype design pattern
2. Implementation guidelines
3. Shallow and deep copy

Gang of Four Definition : “Prototype Design Pattern Specify the kind of objects to create using a prototypical instance, and create new objects by copying this prototype”

To simplify, instead of creating object from scratch every time, you can make copies of an original instance and modify it as required.

Prototype is unique among the other creational patterns as it doesn’t require a class but only an end object.

We need to choose Prototype Design Pattern when
1. Creating an object is an expensive operation and it would be more efficient to copy an object.
2. System should be independent of how its products are created, composed, and represented.
3. Objects are required that are similar to existing objects.
4. We need to hide the complexity of creating new instance from the client.

Shallow and Deep Copy : The idea of using copy is to create a new object of the same type without knowing the exact type of the object we are invoking.

Shallow Copy : copies an object’s value type fields into the target object and the object’s reference types are copied as references into the target object.

Deep Copy : Deep Copy copies an object’s value and reference types into a complete new copy of the target objects.

In our next video we will discuss the significance of shallow and deep copy in Prototype design pattern.

Text version of the video


Design Patterns Tutorial playlist

Design Patterns Text articles and slides

All Dot Net and SQL Server Tutorials in English

All Dot Net and SQL Server Tutorials in Arabic

Did you find apk for android? You can find new Free Android Games and apps.

Leave a Reply

1 Comment on "ProtoType Design Pattern Introduction"

Notify of

15 days 41 minutes ago

thanks a billions