File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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
 
Consider Paul's rocket mass heater.
 
subject: GuiController design