Grokking Design Patterns for Engineers and Managers
0% completed
Flyweight Pattern
The Flyweight Pattern shares the part of an object's state that repeats, so that very large numbers of them fit in memory.
A map application holds a hundred thousand markers. Each marker stores its latitude and longitude, and also its icon bitmap, its colour, and its size. The position is different for every marker. The icon is identical across thousands of them, and the icon is the large field.
A hundred thousand copies of a two megabyte bitmap is not a performance problem. It is a crash.
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%