File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes OO, Patterns, UML and Refactoring and the fly likes MVC questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "MVC questions" Watch "MVC questions" New topic
Author

MVC questions

Alexander Curvers
Greenhorn

Joined: Apr 03, 2009
Posts: 26
In MVC you have
the view sending events to the controller. and the controller sending messages to the model.. thus often the model gets updated.
then the view uses the model to update 'itself'

i have a few questions about the exact implementation
1 how does a view get references to the model objects it needs to update itself.. does the controller return the references to these objects ?

if anyone has links to mvc examples/tutorials where the info is detailed about the implementation.. it would be appreciated
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5274
    
  10

I had the honor of meeting and talking to Trygve Reenskaug, the originator of the MVC pattern, at the SPLASH 2012 conference in Tucson, AZ this past week. Trygve is an amazing person, in his 80s but still very sharp. It might help if you read some background material about MVC, written by Trygve: http://heim.ifi.uio.no/~trygver/themes/mvc/mvc-index.html

In particular, your understanding that the view sends events to the controller is incorrect. In his paper on MVC dated 10 December 1979:
Trygve Reenskaug wrote:..a view should never know about user input, such as mouse operations and keystrokes.

Regarding your question of how the view gets references to the models, what have you tried that made you ask this question and what problems are you encountering?


Junilu - [How to Ask Questions] [How to Answer Questions]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16303
    
  21

One of the most important things to know about MVC is that it's designed so that you can have more than one View of a Model (for example, a chart and a table) and you can have views that reference more than one model object. In other words, Models and Views have a Many-to-Many relationship.

The Controllers bind Models and Views together. A controller handles UI events from the View, posting updates to the Model. Likewise, updates to the Model are reflected into the View by the Controller.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MVC questions