Back to list
Views:   0
Replies:  0
Archived
,
Reply 1
Decorator Pattern:
This pattern can be used in a scenario where particular property is manipulated on the existing object. It favours composition of objects where one object will be composed in to another of same type and it goes on. For eg. Cost of a Car object can vary depend on its model. In this case, each Car model decorator will have composition of Car object and it will operate on its cost. Top Model -> Basic Model -> Car
-> Composition

Strategy pattern:
Lets say you have some workflow design in visual studio. Suppose if you want to open that design in 2 views.
Design mode view
Code view
In this case, "Viewing" is the only one activity that user going to perform, but based on the user's choice the "Strategy" of the viewing will get differ. Suppose if the user selects design view, the strategy is "DesignViewStrategy" and if the user selects code view, then the strategy is "CodeViewStrategy".

So, same activity for the user only the algorithm(Strategy) differs.

Hope the above helps you...

Vivekananda P, Nov 07, 2012
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Licensing       EULA       Sitemap      
© Data & Object Factory, LLC.
Made with    in Austin, Texas