aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes MVC? what's Controller really mean? Why not combine Model(Data) and Controller(method) into one... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "MVC? what Watch "MVC? what New topic
Author

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

Jianping Wang
Ranch Hand

Joined: May 29, 2010
Posts: 60
It really just confuses me. Controller and Model? So If Controller means actions and Model means data, why not combine them together as ActionRepository?



SCJP 6 with 93%
Oracle Database SQL Expert with 98%
Jianping Wang
Ranch Hand

Joined: May 29, 2010
Posts: 60
I found the official article about MVC

http://java.sun.com/developer/technicalArticles/javase/mvc/
Jianping Wang
Ranch Hand

Joined: May 29, 2010
Posts: 60
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
Bartender

Joined: Jul 19, 2004
Posts: 5212
    
  12

Here you'll find more info about the approach I used.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Martin Krischik
Greenhorn

Joined: Apr 29, 2010
Posts: 23

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


SCJP, SCJD, OCPJBCD
Jianping Wang
Ranch Hand

Joined: May 29, 2010
Posts: 60
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
Bartender

Joined: Jul 19, 2004
Posts: 5212
    
  12

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 sorta covered in the JavaRanch Style Guide.
 
subject: MVC? what's Controller really mean? Why not combine Model(Data) and Controller(method) into one...