aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes MVC and java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "MVC and java" Watch "MVC and java" New topic
Author

MVC and java

Rajesh Khan
Ranch Hand

Joined: Oct 16, 2011
Posts: 230
I have a bit of confusion regarding MVC some people say that view should never interact directly with the model and vice versa while others say it can ?? What is the correct way here ?? Furthermore in my applications actions are being performed by anonymous classes in swing. How can i apply mvc here when i my service layer already has services in it suplied by a factory. I mean to say what would the controller look like ??
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
In my use of MVC, the View class always gets handed a reference to the Model to draw data from along with other information required to create a complete display.

The Controller gets involved in the interpretation of the current state of the program and preparing data for output by the view + model.

Generally speaking I find it easy to decide what goes in View and Model classes and a lot harder to separate controller functions into a separate class so controller functions tend to end up scattered around wherever it seems logical.

Bill

Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
I have a bit of confusion regarding MVC some people say that view should never interact directly with the model and vice versa while others say it can ? What is the correct way here ?


There is no single "correct" way to implement the Model-View-Controller design pattern. Design patterns do not dictate or specify implementation details. They provide examples of a possible implementation and serve as design guides. That is all. There can be many variations of a particular design pattern implementation.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MVC and java