Re: Design Question for Model and View
- From: Jason Cavett <jason.cavett@xxxxxxxxx>
- Date: 31 May 2007 07:32:05 -0700
On May 30, 4:24 pm, r...@xxxxxxxxxxxxxxxxxx (Stefan Ram) wrote:
Jason Cavett <jason.cav...@xxxxxxxxx> writes:
The problem I run into (sort of a problem - I can easily hack around
it, but I'm wondering if there's a better way) is that it can be tough
getting information from the user when I need to accomplish a goal.
For example, a model operation might need a yes/no-information.
According to MVC, the model then would change a variable
»information_required« to be »true«. The View would be
subscribed to this as an observer and, thus, become notified
of the need. The view will create a yes/no-requester visible
to the user.
When the user decides to supply the information, the
controller will tell the model, which then will set
»information_required« to »false«, which will make the view to
close the requester.
the model notifies that view
The model must not know that there is a view, otherwise it
would be coupled to the view in a way that is not intended in
MVC.
It only knows that there are observers, so it ... (see above)
The view sets a flag in the main model notifying that it should
save.
In MVC, this would be the part of the »controller«.
But then, maybe you did not want to use MVC at all.
Is this a good way to go about it?
I can not determine, whether a strict and pure application
of MVC is advantageous in your case. I just wrote /how/ to
do it /if/ one wanted to do this.
Things might be simplified by a kind of »hierarchical MVC«,
where the confirmation-logic is contained entirely in the View
of the outer MVC, while it consists of an internal MVC
structure itself.
this. At the same time, it seems overly complicated. I could easilyFrom a theoretical standpoint, this seems to be the best way to do
implement something like this as the foundation for MVC is already
there. I'm just wondernig if this would be the best idea.
Also - the controller - that doesn't necessarily have to be a separate
class, does it? (I didn't think so, but I always get a bit confused
on the actual layout of the model, view and controller. It seems
other people do as well.)
Thanks
.
- References:
- Design Question for Model and View
- From: Jason Cavett
- Design Question for Model and View
- Prev by Date: Re: Design Question for Model and View
- Next by Date: buggy regexp
- Previous by thread: Re: Design Question for Model and View
- Next by thread: JSP Loading Page... Please wait while my code doesn't work!
- Index(es):
Relevant Pages
|