Answer the question
In order to leave comments, you need to log in
flyweight. Why do we need UnsharedConcreteFlyweight and ConcreteFlyweight?
I can't figure out why UnsharedConcreteFlyweight is needed in the Flyweight pattern? Many implement this pattern without this component. How to be with him and what does he do?
Answer the question
In order to leave comments, you need to log in
Imagine that each flyweight instance should have a reference to an immutable 10k x 10k matrix. Since the pattern saves memory, it would be logical to keep the matrix in a single copy, despite the presence of a pool of opportunists. In ConcreteFlyweight this matrix is stored. On the other hand, why do we need a pool of objects if they generally have all the same properties? UnsharedConcreteFlyweight is used to store differences.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question