Prototype Pattern - when creating an object from scratch is expensive, clone an existing one instead. This is also where shallow-copy vs deep-copy bugs come from.
What’s in the video (4m 35s)
- 0:00 Prototype Pattern
- 0:19 Meet Dolly the Sheep
- 0:46 Core Concept of Prototype Pattern
- 1:16 From Dolly the Sheep to Prototype Pattern
- 1:38 What is Prototype Pattern?
- 2:12 How Prototype Pattern Works?
- 3:01 When to Use Prototype Pattern?
- 3:56 Advantage of Prototype Pattern
Resources
- Full Design Patterns series: YouTube playlist
- Previous episode: https://youtu.be/NEUjWiI3uJ8
- Next episode: https://youtu.be/zXuSeeRQGZU
- Source notes / code: https://github.com/learnwithmanoj/design-patterns-simplified/blob/main/07-creational-prototype.md
For more in this series, visit the #design-patterns tag page or jump to the channel uploads list for everything else.