Strategy decorator

Printer-friendly versionPrinter-friendly version
Decorators over strategies

 

Class Diagram III  with specialized interfaces

 

Class Diagram III Benefits

  • This design allows a specialized context to use a specialized interface of the strategy.
  • The strategy can be passed from one or several specialized contexts to another (shared) context with the generalized strategy interface.
  • New specialized interfaces with new operations can be added without having to add or change any strategy or decorator. Just the forwarding to the decorated strategy has to be added.
  • A separate interface for the strategy decorators is already in place and can be used to extend all specialized interfaces of the strategy, hence we do not need to add another interface for that.

 

Class Diagram IV example 1

 

Related Design Patterns

The Strategy Decorator design pattern is closely related to the following design patterns:

  • Decorator
  • Strategy
  • Proxy

 

And is also related to the following design patterns:

  • Chain-of-responsibility
  • Composite
  • Delegation
  • Bridge
  • Adapter
  • Facade
  • Command.

 

Seiten