Uml DP
Uml DP
Uml DP
PATTERN &
ADAPTER DESIGN
PATTERN
CREATIONAL DESIGN PATTERN
• A creational design pattern provide
various object creation
mechanisms.
• These design patterns are used
when a decision must be made at
the time of instantiation of a class
(i.e. creating an object of a class).
• There are 6 types of creational
patterns, prototype design pattern
is one among those.
PROTOTYPE DESIGN
PATTERN:
• The Prototype Design Pattern is a creational pattern
that enables the creation of new objects by copying
an existing object.
• The prototype pattern is a creational design pattern
which is required when object creation is a time-
consuming, and costly operation
• A clone() method is the simplest approach to
implementing a prototype pattern.
• When the client needs a new object, instead of
directly instantiating a class, it requests a copy of an
existing object (the prototype).
COMPONENTS:
• Client : The Client is the code or module that
requests new object creation by interacting with
the prototype.
The Client invokes the Prototype interface, which is
the next component.
• Prototype Interface : This defines the method for
cloning objects and sets a standard that all
concrete prototypes must follow.
Prototype interface includes a clone method, used to
create a copy of all the objects.
• Concrete Prototype : The Concrete Prototype
details how the cloning process should work for
instances of that class and provides the specific
logic for the clone method.
6
WHEN TO USE & WHEN NOT TO USE
PROTOTYPE
DESIGN PATTERN?
• Use the Prototype pattern when creating
new objects is more complex or costly
than copying existing ones. Cloning can be
more efficient if significant resources are
needed.