Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with decorator pattern #27

Closed
claudiofantacci opened this issue Feb 14, 2019 · 2 comments
Closed

Issue with decorator pattern #27

claudiofantacci opened this issue Feb 14, 2019 · 2 comments
Assignees
Labels
Milestone

Comments

@claudiofantacci
Copy link
Collaborator

claudiofantacci commented Feb 14, 2019

We need to rethink the future of the decorator pattern as it cannot work in the followin scenario: a decorated method calls a method of its decorated class which itself calls a class methods. The decorated class will never be able to call a decorated method and this may cause unexpected behaviour when decorator classes are used improperly.

@claudiofantacci claudiofantacci changed the title Decorator pattern conflicts with template method pattern Issue with decorator pattern Mar 18, 2019
@claudiofantacci claudiofantacci self-assigned this May 6, 2019
@claudiofantacci
Copy link
Collaborator Author

It is not clear how to remove the decorator pattern and try to have another strategy to achieve the same goal, i.e. add functionalities to a class method (e.g. before or after some other function calls) without necessarily rewrite/copy-paste the code and add other functionalities.
At present, the decorators are removed entirely, but this issue will remain open for keeping record of this and discuss possible solutions.

@claudiofantacci
Copy link
Collaborator Author

A tentative implementation of a new decorator pattern is available here claudiofantacci@4f0966d
The result, however, is way too complicated and requires developers to adopt specific implementation policy in some derived classes. As a consequence, I confirm that I'm removing the decorator pattern entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants