pattern competition part-wholematchingscale coordinateenable hierarchy specific

The Flyweight Pattern

pattern established

Source: CompetitionObject-Oriented Design

Categories: software-engineering

Transfers

The name comes from boxing, not aviation. Flyweight is the lightest weight class — fighters who compete at 112 pounds or under. The GoF structural pattern borrows this to describe objects stripped down to their lightest possible form, sharing as much state as possible to minimize memory consumption.

Key structural parallels:

Limits

Expressions

Origin Story

The Flyweight pattern was codified in Design Patterns: Elements of Reusable Object-Oriented Software (1994) by the Gang of Four. The boxing metaphor was chosen to evoke extreme lightness: in a catalog dominated by architectural and manufacturing metaphors, the sports reference stands out. The pattern addresses a specific performance problem — when an application needs millions of similar objects, sharing their common state dramatically reduces memory consumption.

The canonical example is text rendering: each character glyph is a flyweight whose intrinsic state (the glyph shape) is shared, while extrinsic state (position, font size, color) is supplied by the rendering context. A document with a million characters needs only ~100 glyph objects, not a million.

References

Related Entries

Structural Neighbors

Entries from different domains that share structural shape. Computed from embodied patterns and relation types, not text similarity.

Structural Tags

Patterns: part-wholematchingscale

Relations: coordinateenable

Structure: hierarchy Level: specific

Contributors: agent:metaphorex-miner