• 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

For Max: Controller in MVC

 
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Max,
How was your trip, and How was the seminar?
OK. I want some info regarding MVC. I want to know the role of controller in MVC architecture. Is EventHandler a controller?
In my assignment, I am handling UI events in two classes(ActionEvents is one class, and mouse events in another class). Are these two controllers, or the one which is responsible to retrieve TableDataModel is controller?
Please clarify my doubt.
In your book, controller is different. All events are handled in inner classes in MainWindow.java.
Thanks in advance.
Regards,
Ganapathy.
[ May 29, 2003: Message edited by: S. Ganapathy ]
 
town drunk
( and author)
Posts: 4118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The talk was great: it was in Papanal, which is an Olympic training facility outside of Anheim.
Regarding your question. Are you asking what a controller is, conceptually, or specifically? Conceptually, a controller is something that takes direction from the client, and 'decides' what the client really wants. For example, a waiter in a restaurant is a controller, because they 'decide' what you mean when you say you want your steak to be medium rare.
Similarly, a controller decides what views the client should see: going back to the waiter example, the waiter might decide you're the head of the table, so you get the menu with prices on it, or that the children at your table get kiddie menus.
The point here is that controller provide access to a system, and they can work together. Thus, the kitchen's controller(the chef), might interface nicely with the waiter.
Very nice, but what's my point? The point is that eventHandler you're talking are controllers, but they don't have to be the only controllers. They might interact with another layer, say a Controller interface, that actually talks to the back end.
Make sense?
M
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Make sense?
M"
I don't know if it makes sense, but I am now really hungry. Can you get me a hamburger with some fries?
Mark
 
S. Ganapathy
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Max,
Thanks for your response. I know the role of controller in MVC, but, I was in dialama whether I can use more than one class as controller.
In my GUI client, I am handling all ActionEvents in ActionEventHandler.java which is an inner class, and Mouse events in MouseEventHandler.java, etc. Also I am using GUIController.java to get TableDataModel, and doing some other needed functionality. Whether I can use these two or not, I was not very sure.
I should use as minimum classes as possible. It is the restriction.
In Database, I was given DBAccess interfasce.
Data.java is the implementer for that. LockManager is an inner class, has locking mechanism, and is called by Data.java.
DBAdapter.java(for standalone), RemoteDBClientImple.java(for RMI) implements client interface to fulfill the requirement.
And one ConnectionFactory.java to get local or remote connection. This is the database side.
Max, am I going in the right direction?
Please provide your comments and criticisms.
Thanks in advance.
Regards,
Ganapathy.
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Max,
You probably mean Papendal (near Arnhem)...
TK (from Holland)
 
Max Habibi
town drunk
( and author)
Posts: 4118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do mean Papendal, sorry about the spelling. Had a little fright there too . I was running out there @ night and enjoying the beautiful trails, about 2 am, and saw a rabbit. No big deal: rabbits, right? But then, all of a sudden, I was convinced that where there are rabbits, there are wolves, and that one was going to jump out me. After that, it was quite the interesting night run
M
 
Max Habibi
town drunk
( and author)
Posts: 4118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by S. Ganapathy:
Hi Max,
Thanks for your response. I know the role of controller in MVC, but, I was in dialama whether I can use more than one class as controller.
In my GUI client, I am handling all ActionEvents in ActionEventHandler.java which is an inner class, and Mouse events in MouseEventHandler.java, etc. Also I am using GUIController.java to get TableDataModel, and doing some other needed functionality. Whether I can use these two or not, I was not very sure.
I should use as minimum classes as possible. It is the restriction.
In Database, I was given DBAccess interfasce.
Data.java is the implementer for that. LockManager is an inner class, has locking mechanism, and is called by Data.java.
DBAdapter.java(for standalone), RemoteDBClientImple.java(for RMI) implements client interface to fulfill the requirement.
And one ConnectionFactory.java to get local or remote connection. This is the database side.
Max, am I going in the right direction?
Please provide your comments and criticisms.
Thanks in advance.
Regards,
Ganapathy.


Oh, absolutely, and I think it's a good idea. Your controllers are logically divided for clarity: no problems with that.
M
 
S. Ganapathy
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thankyou very much Max.
Regards,
Ganapathy.
 
reply
    Bookmark Topic Watch Topic
  • New Topic