mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-17 02:59:23 +00:00
fbb12b53ba
I did the job and splitted up the readme, hopefully everything was splitted correctly...
965 B
965 B
layout, title, folder, categories, tags
| layout | title | folder | categories | tags |
|---|---|---|---|---|
| pattern | Flyweight | flyweight | pattern_cat | pattern_tag |
Intent: Use sharing to support large numbers of fine-grained objects efficiently.
Applicability: The Flyweight pattern's effectiveness depends heavily on how and where it's used. Apply the Flyweight pattern 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
- most object state can be made extrinsic
- many groups of objects may be replaced by relatively few shared objects once extrinsic state is removed
- the application doesn't depend on object identity. Since flyweight objects may be shared, identity tests will return true for conceptually distinct objects.
Real world examples:
