Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: About to upload - quick MVC question

 
Jamie Orme
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
I have coded my MVC using the hook methods described in previous posts. One thing is bugging me though (last minute check before upload) - should the view ONLY be passing on actions to the controller that will ultimately require the controller to pass onto the model? For example, I can see how a search action or a book action should work, but what about displaying help or having a button to clear the search criteria? They could be achieved entirely within the view.
Sorry, if this question is a bit simple, Im fairly new to MVC! I would be extremly grateful if someone could put me out of my misery and post soon!
Many Thanks
Jamie
 
Jamie Orme
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BTW my current set-up is to have any actions that do not require the model totally within the view (not using 'hook' methods).
Cheers
Jamie
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jamie,
There are some things that can be done completely within the view. You mentioned clearing fields. Another might be initial validation of a field.
There are other interactions that might not need to go via the controller either - the diagram in the Sun Model-View-Controller Blueprint tells you that the View can send a State query to the Model. It is only user gestures that should go via the controller. You could argue that finding out the names of the columns could fall under the state query category, so you could get that directly from the model. But changing the data the model is holding (by doing a query) falls under the user gestures category.
As for the user help - I guess that depends on how you implemented it. Personally I had user help in several seperate help files. These had their own model which retrieved them (to hide the fact that they were in physical files). Since I had several help files, requesting different bits of help could result in the data being modeled by the help model changing. Therefore help requests were sent via the controllers. (I also had a separate view for the online help, in it's own JFrame, but that is a separate story).
Does this clarify it? Or have I just confused you further?
Regards, Andrew
 
Jamie Orme
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andrew
Thanks for the reply.
I think I follow what you are saying (it is early in the morning here in the UK ). I think I will leave things as they are and not implement the 'hook' methods for any action that doesnt require the model (anyone have a contradictary view on this?) . BTW my on-line help is in HTML, that that has a front page with links to specific items. Its not brilliant, but it does the job!
Thanks again
Jamie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic