Flyweight

E173613

Flyweight is a structural design pattern that minimizes memory usage by sharing common, immutable state among many fine-grained objects.

All labels observed (2)

Label Occurrences
Flyweight pattern 4
Flyweight canonical 1

How this entity was disambiguated

Statements (45)

Predicate Object
instanceOf software design pattern ⓘ
structural design pattern ⓘ
appliesWhen a large number of similar objects are used ⓘ
most object state can be made extrinsic ⓘ
object identity can be shared ⓘ
belongsTo Gang of Four design patterns ⓘ
benefit lower memory consumption ⓘ
potential performance improvement ⓘ
reduced number of physical objects ⓘ
characteristic avoids redundant object storage ⓘ
reduces memory footprint ⓘ
separates intrinsic and extrinsic state ⓘ
shares common immutable state among many objects ⓘ
supports large numbers of fine-grained objects efficiently ⓘ
commonExample character objects in text editors ⓘ
game objects like trees or tiles in large maps ⓘ
graphical icons shared across UI elements ⓘ
definedIn Design Patterns: Elements of Reusable Object-Oriented Software ⓘ
definesRole Client maintains extrinsic state and uses flyweights ⓘ
ConcreteFlyweight implements Flyweight and stores intrinsic state ⓘ
Flyweight interface declares operations that receive extrinsic state ⓘ
FlyweightFactory creates and manages flyweight objects ⓘ
ensures extrinsic state is supplied by clients at runtime ⓘ
intrinsic state is shared and immutable ⓘ
hasCategory structural pattern ⓘ
introducedBy Erich Gamma ⓘ
John Vlissides ⓘ
Ralph Johnson ⓘ
Richard Helm ⓘ
oftenUsedWith Factory Method pattern ⓘ
linked to: Factory Method

Singleton pattern ⓘ
primaryGoal improve performance with large numbers of objects ⓘ
minimize memory usage ⓘ
relatedTo caching ⓘ
object pooling ⓘ
tradeoff client must manage extrinsic state ⓘ
increased complexity in state management ⓘ
typicalParticipants Client ⓘ
ConcreteFlyweight ⓘ
Flyweight interface ⓘ
FlyweightFactory ⓘ
UnsharedConcreteFlyweight ⓘ
usesConcept extrinsic state ⓘ
intrinsic state ⓘ
object sharing ⓘ

How these facts were elicited

Referenced by (5)

Full triples — surface form annotated when it differs from this entity's canonical label.

Proxy pattern → relatedTo → Flyweight pattern ⓘ
linked to: Flyweight
ConcreteFlyweight → partOf → Flyweight pattern ⓘ
linked to: Flyweight
Composite pattern → relatedTo → Flyweight pattern ⓘ
linked to: Flyweight
Gang of Four design pattern → hasExample → Flyweight pattern ⓘ
linked to: Flyweight