Prototype Design Pattern in Visual Basic .NET

Prototype Design Pattern comes under the Creational Pattern. This pattern also is used to create object. In this pattern you create a clone of an existing object with out creating new object

Why do you clone objects?

  • Creating heavy objects consume memory
  • It takes time to create new object if it consumes lots of resources

Following digram shows the UML diagram of the Prototype Design Pattern

Shape

This is the interface with clone() method which is used to clone the object

Circle and Rectangle

These are concrete classes which implements the clone() of the interface

Client

This is used to create the clone using Shape class

 

Now we will see how we can implement Prototype Design Pattern in Visual Basic. This is the UML diagram which we can used to code in VB.NET

 

Leave a Reply

Your email address will not be published. Required fields are marked *