design-patternsumlchain-of-responsibilitymicro-architecturedecorator

How can I add a decorator pattern to a chain of responsibility?


I created the following UML. It's basically a currency converter. As it is now, it is a Chain of Responsibility. But now I want to add a Decorator pattern. So, for example, add a fixed processing amount. How can I insert a Decorator pattern here? Thanks for the help!

COR


Solution

  • The chain of responsibility aims to give to more than one object (instances of WR specializations) the possibility to handle a request, here the umrechnen() operation. A decorator is meant to add extra responsibility, such as computing some fixed transactional fees.

    Several solutions can be considered, depending on your intent:

    A third approach that is worth to explore is hybrid: