Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help!My Design of db Package

 
guoyuan zhao
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,Michael,Debra and other professionals ,I am a new one here,I need your help~
Pls look at my design:The whole project is devided into three packages
db
dbserver
dbclient
Now I design the db package like this:
--------------------------------------
DataInterface - containing all public methods in Data
Data - implements DataInterface
DataInfo
FieldInfo
Parser - to parse search arguments from client
----------------------------------------
As the instruction says I should implement the criteriaFind(String), lock(int) and unlock(int) methods,I think I should implement lock(int) and unlock(int) in a LockManager in the server side and implement the criteriaFind(String) in the Parser ,So I left lock(int) and unlock(int)methods in Data ,am I right?Pls give me your advice~Thx in advance!
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guoyuan,

Data - implements DataInterface

That's really not necessary. It is probably a better design to have another class (or classes) implement DataInterface and hold a private reference to the Data object.

So I left lock(int) and unlock(int)methods in Data ,am I right?

I think your are saying here that you left lock and unlock unimplemented in Data and implemented them in your lock manager. That's what I did, but it's perfectly acceptable to implement them in Data.

Parser - to parse search arguments from client

I did something similar but created an interface so that it would be easy to expand searching capabilities in the future. My criteriaFind was in a class that implemented that interface.
Hope this helps,
Michael Morris
[ August 13, 2002: Message edited by: Michael Morris ]
 
guoyuan zhao
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael,thanks for ur reply!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic