Flyweight

Flyweight: share immutable objects to save memory

Problem: you'd otherwise create thousands of identical, unchanging objects β€” wasting memory.

PawWalk scenario: thousands of Dog records, but only a few dozen breeds. Intern each Breed once and share the single instance across every dog of that breed.

The realization is a cache: a hash keyed by the intrinsic value, returning the SAME object every time.