aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Utility Class MVC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Utility Class MVC" Watch "Utility Class MVC" New topic
Author

Utility Class MVC

Ajit Kumar
Ranch Hand

Joined: Jan 27, 2001
Posts: 81
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
manish p
Greenhorn

Joined: Aug 20, 2001
Posts: 6
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.
Desai Sandeep
Ranch Hand

Joined: Apr 02, 2001
Posts: 1157
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).]


<b>Sandeep</b> <br /> <br /><b>Sun Certified Programmer for Java 2 Platform</b><br /> <br /><b>Oracle Certified Solution Developer - JDeveloper</b><br /><b>-- Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java </b><br /><b>-- Object-Oriented Analysis and Design with UML</b><br /> <br /><b>Oracle Certified Enterprise Developer - Oracle Internet Platform</b><br /><b>-- Enterprise Connectivity with J2EE </b><br /><b>-- Enterprise Development on the Oracle Internet Platform </b>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Utility Class MVC