wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes MVC and Client GUI (B&S) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "MVC and Client GUI (B&S)" Watch "MVC and Client GUI (B&S)" New topic
Author

MVC and Client GUI (B&S)

Alexander Fritz
Greenhorn

Joined: Oct 06, 2006
Posts: 2
Hello,

I would like to know your opinions about my approach for the client GUI design. I have two main classes, one which handles with the GUI (buttons, combo boxes and a JTable) and other implementing the data model. The data model extends an AbstractTableModel and is used by the JTable component in the GUI.

To connect both classes I have used adapter classes. Moreover, I delegate all the logic regarding the data to the data model class. That means for instance, that when a user presses the book button, an adapter class signals the data model to connect to the database and update its data accordingly.

However, a colleague from me says that it is better to move the logic connecting the database to the adapter class (opposite to my approach) and then, once the adapter class retrieves the new data, it is passed to the data model to also update the data displayed in the GUI.

My decission is based on the opinion that when future enhanecements are needed, such as move to another database system, it will be only necessary to rewrite the model thus, reusing the GUI and the adapter classes.

But as I'm not an expert in design patterns, I'll be very glad to hear about your approaches to this problem.
Anthony Bull
Greenhorn

Joined: Nov 08, 2004
Posts: 8
I went with the same approach as you. An adapter should NOT be implementing business rules, as it is simply adapting your service/business model to be accessible over a network. Don't listen to your colleague, you are on the right track! Sounds like your colleague hasn't done the certification yet.
Alexander Fritz
Greenhorn

Joined: Oct 06, 2006
Posts: 2
Thanks for your comment. I am ready to submit (in fact I was thinking to do it within this week) and wanted to know some oppinions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MVC and Client GUI (B&S)
 
Similar Threads
JTable Question
NX:why the client mode cannot update the Jtable?
About JTable
JTable question
JTable