Forums Register Login

MVC pattern questions

+Pie Number of slices to send: Send
I have ConnectionView and ConnectionController classes.
Connection View allows user to select local/remote mode (a radio group). After selection, user enters for ex. file name for local mode; dns name and port no for remote mode to connect to FBN system. This class has hook methods for all items those can listen for events. It also has set/get and enable/disable methods. These methods are called from ConnectionController.
ConnectionController class has implmentation for all hook method and calls
set/get and enable/disable methods on ConnectionView class.
Questions:
1. I do not have seperate model class for this. This does not have a scope for a seperate model class; does it ? Can i say that class combines view and model both ?
2. Can View have set/get methods ?
3. In some places(books or sample code) , listener has been implemented in the same file which has view class. What is good way; to seperate the controller in sepertate file, instead of in the same file having private/annonymous classes as implementation of listener ?
4. Am i right, if i say following for couplings of MVC classes.
Model does not have any reference of View and Controller.
View does not have reference of Contoller, but can have ref of Model.
Controller must have reference of View, and can have reference of Model.

Regards,
Shashi
+Pie Number of slices to send: Send
Come on guys, please clarify my doubts on MVC. Its really stoping me to go ahead further.
+Pie Number of slices to send: Send
Hi Akash,
This sounds more like the View Helper design pattern.
Note that you do not have to use the MVC pattern (there is no "must" requirement for it).

Can View have set/get methods ?


Yes, this is possible. You might want to consider whether the getter / setters are there to help the view do it's work, or whether you are trying to have the view act as the model though.

What is good way; to seperate the controller in sepertate file, instead of in the same file having private/annonymous classes as implementation of listener ?


Take a look at Eugene Kononov's suggestion for an MVC

Am i right, if i say following for couplings of MVC classes.

  • Model does not have any reference of View and Controller.
  • View does not have reference of Contoller, but can have ref of Model.
  • Controller must have reference of View, and can have reference of Model.


  • The model may be observable, in which case it has references to all it's observers. It does not know anything about the observer other than the fact it is an observer.
  • View can have references to both model and controller, but may not need either
  • Yes


  • Regards, Andrew
    +Pie Number of slices to send: Send
    Thanks Again, Andrew.
    Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com


    reply
    reply
    This thread has been viewed 638 times.
    Similar Threads
    Hook methods again!
    GUIContoller
    on UI design :(
    Complications decoupling View and Controller
    passed 151/155!!!
    More...

    All times above are in ranch (not your local) time.
    The current ranch time is
    Mar 28, 2024 16:36:53.