inetbot web crawler
Main  |  Get access to the repository  |  API  |  The robot  |  Publications  |  Usenet Groups  |  Plainweb  | 
 inetbot - Groups (beta)

Current group: comp.object

Model View Controller

Model View Controller  
Philip Poole
 Re: Model View Controller  
AlexKay
 Re: Model View Controller  
Philip Poole
From:Philip Poole
Subject:Model View Controller
Date:Thu, 13 Jan 2005 14:40:44 -0000
Hello everyone,

I am coding a system which I am trying to base on the MOdel View Controller
Pattern. I have my model sorted out but I am not trying to asertain what is
the view and what is the controller.

Example: There are two ways to create me model, through a user interface or
through loading up a configuration or settings file using XML. To me these
seem like controllers, creating and altering the model.

However I also want to be able to save my UI changes as to the XML file, as
well as see my changes on screen. So these are two views, a XML view and a
UI view.

However waht I am worried abaout is that I have identified the view and
controller incorrectly. Also the loading and saving of the XML should be to
the same format and I am worried that by changing the load controller, it
would be very easy to foget the "Save" controller.

Peoples ideas and opionion on my apprach will be really welcome.

Thankyou

Philip
From:AlexKay
Subject:Re: Model View Controller
Date:Fri, 14 Jan 2005 08:24:32 GMT
"Philip Poole" wrote in message
news:41e688c2$0$4626$db0fefd9@news.zen.co.uk...
> Hello everyone,

Hi,

> I am coding a system which I am trying to base on the MOdel View
Controller
> Pattern. I have my model sorted out but I am not trying to asertain what
is
> the view and what is the controller.

In traditional MVC, the controller takes user inputs or events and causes
changes in the model.
The view displays the model. The view is able to query the model to get the
latest info (once notified by the model that a change occurred).

The sequence is:-
The user drives the view.
The view drives the controller by way of events, like onSaveButtonClicked.
The controller handles user events and consequently drives the model.

Then the model notifies its observers that a change occurred.
The Observers query the model to get the latest and then act accordingly.

Or
User => Controller => Model => Observers. Observer < model.

> Example: There are two ways to create me model, through a user interface
or
> through loading up a configuration or settings file using XML. To me
these
> seem like controllers, creating and altering the model.
>
> However I also want to be able to save my UI changes as to the XML file,
as
> well as see my changes on screen. So these are two views, a XML view and
a
> UI view.

I would let the model encapsulate its own persistence, I would not speak of
the model's XML representation as a view. Although I know what you mean I
can imagine how that terminalogy might cause confusion. The model and view
should be completely separate.

The XML is just the model's chosen persistence mechanism. It might've been a
database, file or whatever. So let the model worry about that as part of its
private doings. Sure it can use xml, jdbc, file, adapters, facades, template
method or whatever but I just would not call it a view of any kind (in
traditional MVC parlance) at least.

> However waht I am worried abaout is that I have identified the view and
> controller incorrectly. Also the loading and saving of the XML should be
to
> the same format and I am worried that by changing the load controller, it
> would be very easy to foget the "Save" controller.
>
> Peoples ideas and opionion on my apprach will be really welcome.

What you've described can be made to work but it isn't strictly speaking
traditional MVC.

Actually most MVC's these days are variations:-
1. Model-View-Presenter (MVP). The controller gets a promotion to
application scope, gets a new title "Presenter" and ends up being the boss.
It ties everything together.
2. MVP with Passive Model. The model and view don't do observable/observer.
3. Document/View (MFC) or Delegate model (Swing). The view and controller
are mixed together.

> Thankyou
>
> Philip

Hope that helps.
Alex Kay
From:Philip Poole
Subject:Re: Model View Controller
Date:Fri, 14 Jan 2005 17:21:10 -0000
Thankyou Alex,

That was really helpful and am changing my model accordingly.

I am actually coding in c# and realised that I can use the XMLSerializable
functiolnaliy to automatcially convert my model to an XML file and back ( at
least I hope I can after testing).

Again thankyou for your comments

Philip

"AlexKay" wrote in message
news:4lLFd.118024$K7.115610@news-server.bigpond.net.au...
> "Philip Poole" wrote in message
> news:41e688c2$0$4626$db0fefd9@news.zen.co.uk...
> > Hello everyone,
>
> Hi,
>
> > I am coding a system which I am trying to base on the MOdel View
> Controller
> > Pattern. I have my model sorted out but I am not trying to asertain
what
> is
> > the view and what is the controller.
>
> In traditional MVC, the controller takes user inputs or events and causes
> changes in the model.
> The view displays the model. The view is able to query the model to get
the
> latest info (once notified by the model that a change occurred).
>
> The sequence is:-
> The user drives the view.
> The view drives the controller by way of events, like onSaveButtonClicked.
> The controller handles user events and consequently drives the model.
>
> Then the model notifies its observers that a change occurred.
> The Observers query the model to get the latest and then act accordingly.
>
> Or
> User => Controller => Model => Observers. Observer < model.
>
> > Example: There are two ways to create me model, through a user
interface
> or
> > through loading up a configuration or settings file using XML. To me
> these
> > seem like controllers, creating and altering the model.
> >
> > However I also want to be able to save my UI changes as to the XML file,
> as
> > well as see my changes on screen. So these are two views, a XML view
and
> a
> > UI view.
>
> I would let the model encapsulate its own persistence, I would not speak
of
> the model's XML representation as a view. Although I know what you mean I
> can imagine how that terminalogy might cause confusion. The model and view
> should be completely separate.
>
> The XML is just the model's chosen persistence mechanism. It might've been
a
> database, file or whatever. So let the model worry about that as part of
its
> private doings. Sure it can use xml, jdbc, file, adapters, facades,
template
> method or whatever but I just would not call it a view of any kind (in
> traditional MVC parlance) at least.
>
> > However waht I am worried abaout is that I have identified the view and
> > controller incorrectly. Also the loading and saving of the XML should
be
> to
> > the same format and I am worried that by changing the load controller,
it
> > would be very easy to foget the "Save" controller.
> >
> > Peoples ideas and opionion on my apprach will be really welcome.
>
> What you've described can be made to work but it isn't strictly speaking
> traditional MVC.
>
> Actually most MVC's these days are variations:-
> 1. Model-View-Presenter (MVP). The controller gets a promotion to
> application scope, gets a new title "Presenter" and ends up being the
boss.
> It ties everything together.
> 2. MVP with Passive Model. The model and view don't do
observable/observer.
> 3. Document/View (MFC) or Delegate model (Swing). The view and controller
> are mixed together.
>
> > Thankyou
> >
> > Philip
>
> Hope that helps.
> Alex Kay
>
>
   

Copyright © 2006 inetbot   -   All rights reserved