In Decorator pattern you are supposed to wrap decorators around one central ConcreteComponent. But as far as I can see from looking at the class diagram (from Wikipedia) is that nothing is stopping me from using a ConcreteDecorator as the central element. And this is obviously not great, because its implementation of operation()
most probably contains component.operation()
. Do I miss something here? Is there a guard that I do not see that makes sure that the central element that is being decorated is a ConcreteComponent?
samedi 21 mars 2020
In decorator pattern how do you make sure the lowest level element is not a decorator?
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire