Flyweight : Design Patterns in TypeScript

Flyweight : Design Patterns in TypeScript

Channel:
Subscribers:
24,900
Published on ● Video Link: https://www.youtube.com/watch?v=8y35OCxxFcw



Duration: 5:23
0 views
1


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/flyweight/

Fly in the term Flyweight means light/not heavy.

Instead of creating thousands of objects that share common attributes, and result in a situation where a large amount of memory or other resources are used, you can modify your classes to share multiple instances simultaneously by using some kind of reference to the shared object instead.

The best example to describe this is a document containing many words and sentences and made up of many letters. Rather than storing a new object for each individual letter describing its font, position, colour, padding and many other potential things. You can store just a lookup id of a character in a collection of some sort and then dynamically create the object with its proper formatting etc., only as you need to.

#flyweightPattern
#typescriptFlyweight
#flyweightPatternTypescript







Tags:
Design Patterns In TypeScript
TypeScript
Design Patterns
flyweight
flyweight pattern