Here is the flyweight pattern structural diagram:
Here you see UnsharedConcreteFlyweight which GoF explains:
UnsharedConcreteFlyweight : Not all Flyweight subclasses need to be shared. The Flyweight interface enables sharing; it doesn't enforce it. It's common for UnsharedConcreteFlyweight objects to have ConcreteFlyweight objects as children at some level in the flyweight object structure (as the Row and Column classes have).
Here as much as I understand Operation takes in extrinsicState as argument, but it will not use it at all, as far as it has allState as member data.
Is it a good design? To take arguments you don't use, and if you will use, then you will have data duplication. This may even be Liskov Substitution Principle violation?
Aucun commentaire:
Enregistrer un commentaire