flyweights
The flyweight pattern is a structural object-oriented design pattern. It is used to support a large number of small objects efficiently. This pattern is particularly useful when dealing with a vast number of similar objects that share common intrinsic properties. The core idea is to divide objects into two parts: intrinsic and extrinsic. Intrinsic state is shared among similar objects and is stored outside the object, while extrinsic state is unique to each object and is passed in as parameters.
By sharing the intrinsic state, the flyweight pattern reduces the memory footprint of the application. Instead
The extrinsic state is maintained by the client and passed to the flyweight object when its methods