• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MVC and java

 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ??
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic