Prototype : Design Patterns in TypeScript

Опубликовано: 25 Май 2021
на канале: SBCODE
1,254
18

Design Patterns In TypeScript (book)
https://www.amazon.com/dp/B0948BCH24 : ASIN B0948BCH24
https://www.amazon.com/dp/B094716FD6 : ASIN B094716FD6

Documentation : https://sbcode.net/typescript/prototype/

The Prototype design pattern is good for when creating new objects requires more resources than you want to use or have available. You can save resources by just creating a copy of any existing object that is already in memory.

E.g., A file you've downloaded from a server may be large, but since it is already in memory, you could just clone it, and work on the new copy independently of the original.

In the Prototype patterns interface, you create a clone method that should be implemented by all classes that use the interface. How the clone method is implemented in the concrete class is up to you. You will need to decide whether a shallow or deep copy is required.

A shallow copy, copies and creates new references one level deep,
A deep copy, copies and creates new references for all levels.

#prototypePattern
#typescriptPrototype
#prototypePatternTypescript


На этой странице сайта вы можете посмотреть видео онлайн Prototype : Design Patterns in TypeScript длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь SBCODE 25 Май 2021, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 1,254 раз и оно понравилось 18 зрителям. Приятного просмотра!