vendredi 16 septembre 2016

Decorator pattern - concrete components incompatibility

What do you do for the cases when your decorator is applied to an incompatible component?

If you consider the classic example given to illustrate the use of the pattern, the graphical window, what happens if you apply (say) a scrollbar decorator to a dialog ("dialog" being a concrete window component having a fixed size)? Or rather, what "should" happen? (I'm thinking that ideally "nothing" should happen, at least in terms of what the user of the scrollbar-decorated-dialog sees on their screen, but I'm more interested in strategies to avoid people doing stupid things.)

Aucun commentaire:

Enregistrer un commentaire