Forums Register Login

MVC question

+Pie Number of slices to send: Send
I just read the Head First - Design patterns and aftrer the Compund Pattern chapter(on the MVC) some question just raise in to my head.

I design the URLyBird 1.3.3 and on the client side I manipulate data but I get this data(s) from the server side, responsable for the data "transport" is in my case the controller - he interacts whit the server, gets the information and packs it in to a model(or it changes the model).The model informs the view about the changesadn so on.

In the Head First - Design patterns on the Compound Patterns , MVC I found :
*The controller implementes the behavior for the view
*The model implements the application logic - the application logic is the code that manages and manipulates the data.

I think this can be true if I have only a pure MVC whitout a relation with an existing system.If you integrate your MVC in to a system then the controller is the "link" between your applicaion(MVC) and the rest of the system.Basic I have somethig like:

user -> view -> controller -> system

if the user interact with the view and :

system -> controller -> model -> view

if the system react(responds).The same logic I found in Max book.

I know that ther are many ways to implement (correct) the MVC pattern but is wrong to make the controller responsable for the "data" transport ?
[ June 01, 2005: Message edited by: Mihai Radulescu ]
+Pie Number of slices to send: Send
Hi Mihai,

in Head First Design Patterns (HFDP) the controller is not communicating with the server as you say. Or if so, tell me on which page of HFDP you saw it?

Instead the controller is only communicating with the view and the model.

Regards,
Darya
+Pie Number of slices to send: Send
Hi, Darya,
You are right thats what I try to say in the HFDP the (creamy) controller is communicating

with the view to change the display
with the model to chage its state
with the system/out side world(if you take a look at 529 the user/system does the "Paly the new song" action on controller)

BUT in HFDP the code that manages/manipulates the data is on the model.
If you follow this logic for a if the client musts dispaly data from the server, its model must be able to "manipulates"/transports this information(and this is relativ simple if you hide all behind a proxy).


On Max book the controller "manipulates"/transports the data from server to the cleint(s )and them it builds the model (see the method find(String) VDTableModel from the gui package).

So if in HFDP the model "hides" the comunication between client and server on Max the server does this.

So what you think ? Whitch one is "better" ?
[ June 01, 2005: Message edited by: Mihai Radulescu ]
+Pie Number of slices to send: Send
Hi Mihai,

I've seen people here who let the controller do the communication with the system to access the data from data file.

To my opinion it's better done from the model. Because the model is the data representation on the client side and hence has a tight relation to the database.

For me, the controller is simply delegating the view input to the model.

Nevertheless both approaches seem to be valid.

Regards,
Darya
+Pie Number of slices to send: Send
Darya, I update(more details) my previous post.
And you are right I also think that the model musts comunicate with the data base.
I try to design and maybe I come with an example to this case.

How you find the HFDP ?

P.S: take a look in
JavaRanch Big Moose Saloon � Engineering � OO, Patterns, UML and Refactoring � MVC question

I post a similar question also there and i got some interestiong answers.
[ June 01, 2005: Message edited by: Mihai Radulescu ]
Make yourself as serene as a flower, as a tree. And on wednesdays, as serene as this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 827 times.
Similar Threads
MVC question
Cleared SCJD (UrlyBird 1.3.3) with 381
URLyBird 1.3.3. Wrapping RemoteExceptions
MVC for click and drag interface with multiple models
URLyBird 1.3.3 - a few questions
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 02:09:44.