This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of TensorFlow 2.0 in Action and have Thushan Ganegedara on-line!
See this thread for details.
Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Can I use Command in the Controller?

Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I plan to use Command pattern in the communication of View and Controller. The view sends CreateRecordCommand/UpdateRecordCommand/DeleteRecordCommand to Controller, in the Controller there's only one method handleCommand(Command cmd).
In SL-285 student guide, there're many methods in Controller such as handleXXXGesture().
Is my design a right MVC pattern?
author and jackaroo
Posts: 12199
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David,
There are many tiny variations you can make, and still be conforming to the MVC pattern. So your current way of implementing MVC is fine - your student guide is just recommending another variant.
The logic behind the student guide's variant (if I understand your description) is that the view should only be concerned with displaying the data, and all user interaction should be sent directly to the controller, which then works out what to do with it.
(This is the standard way of implementing MVC in web architecture: the view is usually a JSP and has no logic for handling user actions - the user actions are normally sent via a POST or a GET directly to a Servlet which acts as the controller.)
Your student guide should show how to get the user actions sent to the controller class. If not, you could take a look at the thread "Confused with MVC" in which Eugene Kononov provides an example of one way to do this.
Regards, Andrew
Yes, of course, and I accept that blame. In fact, i covet that blame. As does this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic