• 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

MVC? what's Controller really mean? Why not combine Model(Data) and Controller(method) into one...

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It really just confuses me. Controller and Model? So If Controller means actions and Model means data, why not combine them together as ActionRepository?
 
Jianping Wang
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found the official article about MVC

http://java.sun.com/developer/technicalArticles/javase/mvc/
 
Jianping Wang
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you guys use the modified MVC (controller becomes mediator) or original one (in this case model and view sync with each other)?
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here you'll find more info about the approach I used.
 
Greenhorn
Posts: 23
Android Scala VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jianping Wang wrote:It really just confuses me. Controller and Model? So If Controller means actions and Model means data, why not combine them together as ActionRepository?



In the Sun course which accomplished the certification you learn to put the model server side and the controller client side. Of course no where in the assignment it says you need to use that approach.

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

Roel De Nijs wrote:Here you'll find more info about the approach I used.


Your solution is surprisingly simple. I have a RoomServices with 5 methods: find, findByExample, add, remove, book. You have only two, find and book!!!

In MVC, I will choose a different aproach: view doesn't know controller, while controller knows view. Example likes this. To me it is more intuitive: controller forces listener(spy ) into view, when view takes any actions, listener will feedback to controller and controller will take some actions according to it interest.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jianping Wang wrote:Your solution is surprisingly simple. I have a RoomServices with 5 methods: find, findByExample, add, remove, book. You have only two, find and book!!!


That's your own fault: add and remove are not required, so why would you add them to your interface? And you use 2 find-methods, I just use one to take care of the must requirement to search for rooms.
 
It is no measure of health to be well adjusted to a profoundly sick society. -Krishnamurti Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic