This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Help!My Design of db Package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Help!My Design of db Package" Watch "Help!My Design of db Package" New topic
Author

Help!My Design of db Package

guoyuan zhao
Greenhorn

Joined: Oct 09, 2001
Posts: 13
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

Joined: Jan 30, 2002
Posts: 3451
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 ]

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
guoyuan zhao
Greenhorn

Joined: Oct 09, 2001
Posts: 13
Michael,thanks for ur reply!
 
Don't get me started about those stupid light bulbs.
 
subject: Help!My Design of db Package