• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Should Data Class implement both DBAccess and Client interface

 
Theo van Loon
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm working towards a solution but i have one issue left at the moment.
I extended DBAccess and added some extra methods that i needed at client side, such as getData() and getColumnNames().
I implement these methods in my Dataclass, but to access them at client side does my Data class also has to implement the Client interface?
Thanks again
 
George Marinkovich
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Theo,
Originally posted by Theo van Loon:
I extended DBAccess and added some extra methods that i needed at client side, such as getData() and getColumnNames().
I implement these methods in my Dataclass, but to access them at client side does my Data class also has to implement the Client interface?

Yes.
The following code should compile (Data may need to take arguments):

If that compiles, then your Data class is implementing the Client interface. To make it explicit you could do the following:

Hope that helps,
George
 
Theo van Loon
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by George Marinkovich:
Hi Theo,

If that compiles, then your Data class is implementing the Client interface. To make it explicit you could do the following:

Hope that helps,
George

That's a big help George thanks a lot!! But if i have my Data Class implements the Client interface with e.g. getData(), searchRecord(), bookRecord(), what's the whole purpose of the DBAccess interface other than having those methods implemented in the Data classfor use for my Client interface?
 
George Marinkovich
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Theo van Loon:
[CODE]
But if i have my Data Class implements the Client interface with e.g. getData(), searchRecord(), bookRecord(), what's the whole purpose of the DBAccess interface other than having those methods implemented in the Data class for use for my Client interface?

That's about right.
The DBAccess interface is provided by Sun to give some common architectural structure to the assignment. I think this makes it easier to grade as it ensures that each candidate's application will be built out of the same building blocks. In the absence of the Sun-provided interface the range of solutions to the assignment would be much greater. Also it would be more difficult for the grader to create an automated testing harness because the names of the various database operations would be at the discretion of the developer rather than constrained by the interface.
Hope this helps,
George
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic