This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Utility Class MVC

Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Quote
  • Report post to moderator
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,
SCJP2,OCSD(Oracle JDeveloper),OCED(Oracle Internet Platform)
[This message has been edited by Desai Sandeep (edited August 20, 2001).]
Your mind is under my control .... your will is now mine .... read this tiny ad
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic