vendredi 15 décembre 2017

Decorator pattern with decorators that can be implemented independently

I am writing a series of loggers. One will write to console, one to stdout, one to a proprietary file formart. At any point, i want any of these loggers to be able to be implemented and work on their own.

I had intended to use a decorator pattern to stack the loggers on top of each other, but i realize that the decorators are not intended to have the additional responsibilities stand on their own.

So my questions: 1) Is it acceptable for the responsibilities to be able to live on their own? 2) Is decorator pattern still the right path, or is there a pattern that better fits the problem i describe?

Aucun commentaire:

Enregistrer un commentaire