Flyweight

E173613

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

Try in SPARQL Jump to: Surface forms Statements Referenced by

All labels observed (1)

Label Occurrences
Flyweight canonical 1

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 Design Patterns: Elements of Reusable Object-Oriented Software
surface form: 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 NERFINISHED
Richard Helm
oftenUsedWith Factory Method
surface form: Factory Method pattern

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

Referenced by (1)

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