Suggested Pages

Saturday, December 28, 2013

Decorator vs Strategy in a brief description

In this post I will share a good definition found on the WEB about the difference between the Strategy and Decorator Design Patterns.
As the name suggests the Strategy design pattern is dedicated to providing a strategy to the Client while the Decorator design pattern is dedicated to providing an enrichment of a certain functionality.

To be precise the two patterns respond differently to the following question:

Does the functionality need to be swapped or to be added?

  • The design patter Strategy is used to swap different (very different) strategy most of the times.
  • The design patter Decorator is used to add different behaviour (no necessary very different most of the times).

No comments :

Post a Comment

Suggested Pages