Imagine while using the command pattern, I have a quite a few different commands (> 30), now most of them are very similar but they depend upon an answer after execution (think in a dinner example, as the waiter needing feedback from the guest, whether they received the right meal).Now basically I could reduce the numbers of commands and receivers drastically by outsourcing the business logic associated to the answer to an external object, that the client sets on command creation and which will be forwarded the answer, the receiver is getting. (sorry for that sentence)Now would this make sense, or should I rather create a different receiver and command for each type of of command and pack the business logic, concerned with the generated response, inside them. I think kind of both do makes sense to some degree, because in essence those commands are actually different things and treating them the same is merely an abstraction. But it would couple the answering logic to the command and/or its receiver, as well as pollute the application with many mostly similar classes.What would be the most elegant way (if something like this exists), to go about this?
Modifying the Command Pattern
java;design patterns;object oriented