Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Jianping Wang
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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)?
 
Roel De Nijs
Sheriff
Posts: 9828
103
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here you'll find more info about the approach I used.
 
Martin Krischik
Greenhorn
Posts: 23
Android Scala VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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: 9828
103
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic