This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes GuiController design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "GuiController design " Watch "GuiController design " New topic
Author

GuiController design

Maksym Odintsov
Greenhorn

Joined: Jan 22, 2009
Posts: 11
Hi guys. I'm using GuiController class to obtain data class reference and to perform operations needed for GUI like searching records or booking rooms. I can't make my DataRemote class to be DB(data class interface) , because of exceptions that are thrown in the DB interface.
So in the GuiControler class I have one reference to the Data class and other reference to the DataRemote. So in order to avoid many if statements I decided to make Connection class






How do you think about this approach ? Is it ok for the SCJD or should I rethink my design.
Alecsandru Cocarla
Ranch Hand

Joined: Feb 29, 2008
Posts: 158
You can also use the Adapter pattern to adapt the remote interface to DB, or the other way round.


SCJP 1.4 100%
SCJD 99.5%
Maksym Odintsov
Greenhorn

Joined: Jan 22, 2009
Posts: 11
I'm not shure about Adapter pattern. Can you explain me in details how you would adapt the remote interface to DB ?
Ulises Pulido
Ranch Hand

Joined: Jul 24, 2008
Posts: 81
Well I believe what Alecsandru believed (let me know if I am wrong) is that you may be able to use the Strategy Pattern (Having the interface DB implemented on the directConnection and remoteConnection) and the Adapter Pattern together (Having an instance of directConnection inside remoteConnection and calling the methods from directConnection inside remoteConnection)



SCJP 5.0, SCWCD 5.0, SCBCD 5.0, SCJD, SCEA in progress
www.ulisespulido.com
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GuiController design
 
Similar Threads
MetaData framework
RMI Design : Following Max's Book
How to throw RemoteException?
add new method in Interface DB
B&S Data exceptions