Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database Access Class

 
Mickey Mulligan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been digging into my brand new SCJD assignment (contractor) for the past few hours and I've come up against a little problem. My assignment refers to something called the "Database Access Class". This must implement a certain interface, DBAccess, and be named Data.

I can't work out whether this is supposed to be the class that directly read/writes to the database file or not. Can it use another class to access the database file? I'm looking to do something like...

ContractorInformationManagementFacade has-a Data
Data has-a DatabaseFileReadWriter

Hope I'm making some sense!
 
Petr Hejl
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can use any subclass or delegation as far as your class with given name will implement required interface. There is no requirement on how to do it.

But I would ask some more general question. I think it is really not clear in assignment. How should client/server interface should be done. I figured out two options:

a) data interface is also a interface between client and server (some statements in assignment seems to require this, but not in clear way..). Then I will have to implement some lock cleaning mechanism and bussines logic will be on client side

b) interface between client and server is provides bussiness methods (book() for example) that calls some sequences on data interface. This would not require lock clean up code because bussines methods would be located on server. But database interface itself will not be available through network.

Which solution is supposed? Which is better?

Thanks Petr
 
Bob Nedwor
hangman
Ranch Hand
Posts: 215
Eclipse IDE Oracle Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mickey:
I just a have file called DBAccess.java which is really just an interface with all the methods they descbribe in the instructions, but the methods have no statments, because they are all abstract. The file has a line in it at the beginning like this:

Then I have a file called Data.java which is where I build a class "Data" that implements all these methods. It has a line in it that says:

I hope this helps.
[ February 26, 2006: Message edited by: Bob Nedwor ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic