Re: responsiblity about MVC
From: Daniel T. (postmaster_at_eathlink.net)
Date: 04/18/04
- Next message: Doc O'Leary: "Re: responsiblity about MVC"
- Previous message: cass: "More questions of UML"
- In reply to: Sergei Gnezdov: "Re: responsiblity about MVC"
- Next in thread: Robert C. Martin: "Re: responsiblity about MVC"
- Reply: Robert C. Martin: "Re: responsiblity about MVC"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 18 Apr 2004 16:57:48 GMT
Sergei Gnezdov <nobody@nowhere.com> wrote:
>Daniel T. wrote:
> > "Franz" <abc@yahoo.com> wrote:
> >
> >> My understanding on the MVC pattern is still vague. I don't know where the
> >> responsibility goes to.
> >> For example, inside a library system, the librarian uses the system to add
> >> record for new user.
> >> View => The class which generates a form for the librarian to enter the
> >> information.
> >> But for checking whether the user ID is used by others already, I need to
> >> access to the database to query the user record by the new user ID.
> >> If no user record is found, then the new user ID is valid.
> >> My question is, what is the responsiblity of Control and Model in this
> >> situation.
> >> I have read some books and sites. Most of them give me the concept. I
> >> think
> >> I have to consider a real case in order to understand the main idea.
> >> Thanks.
> >
> > I have been following the discussion avidly but wasn't able to formulate
> > anything better than...
>
> Do you think that MVP is applicable to the control design such as
> text box, label, edit area, grid, list?
>
> Does MVC apply to the application design where the controls mentioned
> above are put together on one window or form?
As I understand it currently, in MVP the model *and* view (wich includes
both input and output) can be developed independently from each other,
the presenter layer has the job of tying the two together. With MVC,
input and output are seperated but both the view and controler must be
familliar with the model. IE I see the following dependencies:
[Controler]---->[Model]<----[View]
and
[Model]<----[Presenter]---->[View]
(Note, what I mean by dependency here is that the programer of module A
must know how module B works in order to do his job.)
The unfortunate thing is that both design methods use the word "view"
with completly different responsibilities. Of course, even in MVC there
is some level of "generic input/output components" which would equate to
the MVP's concept of "view". They are simply assumed to exist without
mention. In essence, translating from one to the other would give us
something like:
[input_view]<----[controller_presenter]------>+-----+
|Model|
[output_view]<----[view_presenter]----------->+-----+
input_view + output_view = MVP's View
output_view + view_presenter = MVC's View
input_view + controller_presenter = MVC's Controler
controller_presenter + view_presenter = MVP's Presenter
You see, ultimatly all MVC and MVP designed systems end up with the five
parts presented above, they are just logicly grouped differently.
So to answer your question, I think that the design of controls such as
text boxes, labels, edit areas and the like are one small part of both
MVC and MVP methodologies, and to some extent the methodologies can be
applied at the micro level to the design of these GUI elements.
For example a text entry box: The model would probably simply be a
String...
In MVC, the view would be the parts that disply the string on the
screen, and the controler would be the parts that read the keyboard and
insert characters into the string.
In MVP, the View would be the the parts of the program that display on
the screen, and read the keyboard; the Presenter would be the parts that
translate keyboard input into ascii characters that the string can
accept, and the parts that translate ascii into draw commands.
All these elements are necessary in any design of a text edit field, the
only difference is in how they are grouped.
- Next message: Doc O'Leary: "Re: responsiblity about MVC"
- Previous message: cass: "More questions of UML"
- In reply to: Sergei Gnezdov: "Re: responsiblity about MVC"
- Next in thread: Robert C. Martin: "Re: responsiblity about MVC"
- Reply: Robert C. Martin: "Re: responsiblity about MVC"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|