• 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

Utility Class MVC

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
Where does a utility class fit into the MVC Model .
Can i view it as Controller?
For example: I am using a class with get/set methods for its attributes. This class is used as a parameter to some methods. Instead of sending all variables as different parameters to the method, i am storing all variables inside this object and send the object as a parameter.
Can i say that this class acts like a Controller. It does not actually do the controller task( as per the definition atleast ). Or should it be seen as model.
I'd appreciate any comments
AK
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
As you are using the MVC model, I understand that changes to the model would result in property change events being fired to the controller, which would then update the view. Your class that contains all the properties is part of the model.
Why create a method that takes in your holder class (model), on the controller ??
Why not have the controller as a property change listener on the model ? This way the controller will only need to implement the propertyChanged(PropertyChangeEvent e) method. The model would then fire off property change events, where the PropertyChangeEvent would contain the old and new values.
Hope this helps.
 
Ranch Hand
Posts: 1157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I suppose, the class which contain the domain -specific information (attributes and related information/behavior) could be considered as a Model.The Controller should have a reference to the Model and the View, which listens to the events (like actionPerformed of the View,propertyChange of the Model) and delegates the same to the respective components of the Model or sets the value in the View.
It is not a good idea to merge Model and Controller together.You may face problems if you need to re-design (or add new requirements) in the application.If at all you want to merge, you can have View and Controller as one class, but consider this only if the application is small.
Hope this helps,
Sandeep
SCJP2,OCSD(Oracle JDeveloper),OCED(Oracle Internet Platform)
[This message has been edited by Desai Sandeep (edited August 20, 2001).]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic