• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URLyBird 1.2.3

 
Tiger Hilton
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • 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
 
George Marinkovich
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
  • 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
 
Raj Shekhar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
Thanks George.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic