Exforsys

Online Training

Model View Controller

This is a discussion on Model View Controller within the Software Patterns forums, part of the Testing category; Hello everyone, I am coding a system which I am trying to base on the MOdel View Controller Pattern. I ...


Go Back   Exforsys > Testing > Software Patterns

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-13-2005, 10:27 AM
Philip Poole
Guest
 
Posts: n/a
Model View Controller

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


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-14-2005, 12:43 PM
Manuel Collado
Guest
 
Posts: n/a
Re: Model View Controller

Philip Poole wrote:

> 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.


IMHO, a simple rule of thumb can be:

1. Think about several versions of the same application, with different
user interfaces and even non interactive (command-line) versions.

2. The model is the common parts to all versions (interactive and
non-interactive)

3. The user interface (UI) of an interactive version join together the
view and the controller (or several simultaneous views and controllers).

4. The view is the part of the UI that includes all the necessary
elements to refresh or redraw the UI after some change in the model. It
could be implemented simply as a single global redraw function or as
several partial redraw functions. The view should call the model to get
the updated data.

5. The controller is the remaining part of the UI that is not the view.
Its job is to take input from the user or from external sources and call
the appropriate functions of the model.

6. The model, view and controller have to be synchronized to maintain
the view up-to-date. There are quite different ways of doing it:

6.a The controller can call the view after calling the model.

6.b The model can call the view after changing itself.

6.c A 'notifier' pattern can be used to receive 'register' request from
views and 'change' notifications from the model, and then call the
registered views.

6.d The view can poll the model frequently and refresh itself.

6.x Etc. etc. ...
--
To reply by e-mail, please remove the extra dot
in the given address: m.collado -> mcollado

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-18-2005, 11:47 AM
Philip Poole
Guest
 
Posts: n/a
Re: Model View Controller

Thankyou very mcuh for your help

Philip
"Manuel Collado" <m.collado@lml.ls.fi.upm.es> wrote in message
news:41e7f6c9@news.upm.es...
> Philip Poole wrote:
>
> > 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.

>
> IMHO, a simple rule of thumb can be:
>
> 1. Think about several versions of the same application, with different
> user interfaces and even non interactive (command-line) versions.
>
> 2. The model is the common parts to all versions (interactive and
> non-interactive)
>
> 3. The user interface (UI) of an interactive version join together the
> view and the controller (or several simultaneous views and controllers).
>
> 4. The view is the part of the UI that includes all the necessary
> elements to refresh or redraw the UI after some change in the model. It
> could be implemented simply as a single global redraw function or as
> several partial redraw functions. The view should call the model to get
> the updated data.
>
> 5. The controller is the remaining part of the UI that is not the view.
> Its job is to take input from the user or from external sources and call
> the appropriate functions of the model.
>
> 6. The model, view and controller have to be synchronized to maintain
> the view up-to-date. There are quite different ways of doing it:
>
> 6.a The controller can call the view after calling the model.
>
> 6.b The model can call the view after changing itself.
>
> 6.c A 'notifier' pattern can be used to receive 'register' request from
> views and 'change' notifications from the model, and then call the
> registered views.
>
> 6.d The view can poll the model frequently and refresh itself.
>
> 6.x Etc. etc. ...
> --
> To reply by e-mail, please remove the extra dot
> in the given address: m.collado -> mcollado
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 04:29 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.