let's assume that we have command pattern implemented in this way
I am a bit confused about the role of Invoker here. From my point of view:
- If we do need history (or any kind of action before command execution), then there is a sense in making this class. But then it breaks Single responsibility principle, yeah? Now it's not only a delegate, it also stores history there.
- If we don't need history, I don't see a goal of creating this invoker, that simply performs delegating. Is the only reason for it is just a assumption, that we would need some kind of logic before/after command execution in the future?
Or am I missing something?
Aucun commentaire:
Enregistrer un commentaire