lundi 20 février 2017

Is "Dynamically changing" the primary reason of using "Decorator design pattern" than using a class with lots of public flags to toggle each features?

I am studying Decorator design pattern at the moment and this thinking bother me a lot.

Would it be easier just to have one base class with boolean value corresponding to its feature?

For example: The textview, can have vertical scroll, horizontal scroll, border, etc. if the textview base class has the BOOL for canVerScroll, canHorScroll, hasBorder; why is this not better than Decorator design pattern?

Thanks for helping!

Aucun commentaire:

Enregistrer un commentaire