add Flyweight pattern

This commit is contained in:
Jakub Vojvoda
2016-09-17 14:19:27 +02:00
parent a7768c2e9c
commit 1b71cb14de
2 changed files with 106 additions and 1 deletions

View File

@@ -1,9 +1,12 @@
## Flyweight
Use sharing to support large numbers of fine-grained objects efficiently.
Flyweight pattern has has structural purpose, applies to objects and uses sharing to support
large numbers of fine-grained objects efficiently. The pattern can be used to reduce
memory usage when you need to create a large number of similar objects.
### When to use
* when one instance of a class can be used to provide many "virtual instances"
* when all of the following are true
* an application uses a large number of objects
* storage costs are high because of the sheer quantity of objects