jQuery in Action, 3rd edition
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes MVC Commands Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "MVC Commands" Watch "MVC Commands" New topic

MVC Commands

Murat Balkan
Ranch Hand

Joined: Sep 10, 2002
Posts: 127
Hi all,
So far, I have seen two mvc command designs.
One of them is you create your command classes which have only 1 execute method, that does a spesific job.(Deletecart.class, AddtoChart.class)
The other one is you create a processor with many methods regarding the current action.(ChartProcessor.class)
Which one of them do I have to use?
Thank you
Jeremy Hsu
Ranch Hand

Joined: Mar 28, 2005
Posts: 79

First of all, MVC means model, view, and controller. It describes a way that you can decouple data, presentation, and logics.

On the other hand, the command pattern addresses how you can model an event/command/action using an object, so that you can pass it around. As a result, depending on your MVC design needs, you might utilize command pattern in one of your model, view, or controller. Usually, the command pattern can be used as a helper object in the controller part of the MVC design. Now on to the processor thing that you mentioned, it is actually a mediator pattern. Mediator pattern describes how different objects can send a event/command to a centralized place for processing and managing interactions between these objects. The centralized processing unit is called a mediator. Therefore, it is usually used for implementing the controller part of the MVC design because it fits what the role of a controller perfectly in a MVC design. Therefore, to answer you question, I suggest you go over the command and mediator pattern.

After that, I pretty sure you can understand that you can actually use command pattern in the mediator pattern.
I agree. Here's the link: http://aspose.com/file-tools
subject: MVC Commands
It's not a secret anymore!