Open main menu

CDOT Wiki β

Changes

Decorator

34 bytes removed, 15:47, 28 February 2007
Motivation
==Motivation==
As an example we can look at graphical user interface toolkits a coffee shop ordering service where we want to add responsibility such as scrolling behaviour or border property to individual objects, not to an entire classbeverages can be decorated with different kinds of condiments. By using inheritance to add responsibility to a user interface component is inflexible because it is made staticallythe Decorator pattern one can get their beverage just right and the cost can be easily calculated for every added condiment. A better approach Adding new beverages/condiments is wrapping easy too, just by creating the new class and changing the decorator component in another object dynamicallymenu.
==Sample Code==
1
edit