This chapter covers the Flyweight pattern.
Use sharing to support large numbers of fine-grained objects efficiently.
This pattern may look simple, but if you do not identify the core concepts, the implementations may appear to be complex. Let’s start with a basic but detailed explanation before you implement this pattern.
Sometimes you need to handle lots of objects that are very similar but not exactly the same. The constraint is that you cannot create all of them to lessen resource and memory usage. The Flyweight pattern is made to handle these scenarios. ...