• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MVC Commands

 
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic