vendredi 8 mai 2015

Where does actual business logic belong in Command pattern

Examples on internet confused me about Command pattern like the example here. In most examples the concrete command directly calls one of receiver's methods. So is this the only responsibility of concrete command? Where does the actual business logic belong? In execute() method of concrete command or in some methods of receiver?

Another question is if we want to implement multi threaded command pattern, our thread pool should receive commands from Invoker and run the execute() methods of concrete commands? Is my understanding correct?

Aucun commentaire:

Enregistrer un commentaire