vendredi 6 mars 2015

Any pattern name for commands that are handled instead of executed

The command pattern of Gof describes a command with an execute method. This is in Wpf and Silverlight for example defined in the ICommand interface, enriched with a CanExecute Method. This type of commands encapsulates the parameters for the action to be executed, and the logic to call the execution. To do that it must know the execution context (where the execute method can call the desired method and where the canexecute method can validate if its possible). This type of commands are responsible for their own execution.


In CQRS for example an other type of "Command" is used. It has no Execute Method on its own and is not responsible for its own execution. It just encapsulates the needed parameters and is handled by a command handler, that makes the call. This type of command has the advantage that it does not need to know the execution context, is therefor easier to serialize and it has more separation of concerns.


My question know is: The first typ of command is covered in the Gof "Command pattern". Is there any pattern name for the seccond type of command?


I have an application where I want to use both types of command and I have to choose different names for them. I tend to "Command" and something like "HandledCommand" but I would like to choose a well known pattern name if there is one.


Aucun commentaire:

Enregistrer un commentaire