Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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 ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

GuiController design

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also use the Adapter pattern to adapt the remote interface to DB, or the other way round.
 
Maksym Odintsov
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not shure about Adapter pattern. Can you explain me in details how you would adapt the remote interface to DB ?
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)

 
Watchya got in that poodle gun? Anything for me? Or this tiny ad?
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic