Перейти к содержимому

ProtoType Design Pattern in swift

RK Tech Guru

0:00 / 0:00

ProtoType Design Pattern in swift

14 просмотров · 11 часов назад
RK Tech Guru
7 подписчиков
14 просмотров · 11 часов назад
Prototype Design Pattern: The Prototype design pattern is a creational design pattern, that creates new object by cloning existing instance(called a prototype) instead of instantiating from scratch. When to Use: When object creation is expensive(due to computation or setup) When object have many configurations options The prototype pattern is creational designing pattern which is required when object creation is a time-consuming, and costly operation, so we create objects with the existing object itself to by copying the existing ones. The cloned object can modify only the required properties, avoiding unnecessary changes to the original object. This approach saves time and system resources, especially when object creation is expensive or complex. The clone() method is a simple way to implement this pattern, but the cloning logic depends on the specific business requirements.