• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

URLyBird 1.2.3

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is Max's design:
GUIController
|
DBAdapter- - - -implements- - - -DBAccess
|
Data

This is what Sun expects?:
GUIController
|
Data- - - -implements- - - -DBAccess

How do you include an adapter when Data implements DBAccess?
With thanks,
TH
 
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tiger,
How about this?:
GUIController
|
DBAdapter- - - -implements- - - -YourDBAccessInterface
|
Data- - - -implements- - - -DBAccess
|
+- - - -implements- - - -YourDBAccessInterface
(although not necessarily explicitly)
You may not need the following functionality depending on the rest of your design, but this allows GUIController to have a YourDBAcessInterface reference which may be instantiated as either a DBAdapter object or as a Data object.
Hope this helps,
George
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
George,
My design is as below:
GUIController
|
DBAdapter- - - -implements- - - -DBAccess and CustDBAccessInterface
|
Data
|
+- - - -implements- - - -DBAccess
(Not explicitly)
I chose this design as my core data base implementation is separated from interface(s) and in future user can add or extend interface without touching Data class.
However, after reading this question, I am not sure if I have to explicitly implement DBAccess in the Data class
(I mean do I have to add the line 'Data implements DBAccess in the declaration of Data?).
My instructions say -
----------------------------------------------------------------------
"Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the following interface."
--------------------------------------------------------------------------
I took it to mean that class should provide the implementation and it does not have to be explicit. Please comment.
thanks,
Raj
 
George Marinkovich
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Raj,
I think your interpretation is technically sound, that is, that Data merely has to implement DBAccess (but does not necessarily have to be declared with an explicit "implements DBAccess" clause). So if can do the following with your code without a compilation error you should be OK:

However, put yourself in the position of the Sun grader. One of the requirements he has to check is that your Data class implements the DBAccess interface. The following sure makes his job easier:

So, if it's possible for you to be explicit I think it's to your advantage. It's a pretty good idea, in my opinion, to give the grader as much assistance as he needs to give you the full 400 points on the exam.
Hope this helps,
George
 
Raj Shekhar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks George.
 
Could you hold this kitten for a sec? I need to adjust this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic