File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes coupling between client and server Packages. 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 "coupling between client and server Packages." Watch "coupling between client and server Packages." New topic
Author

coupling between client and server Packages.

Manish Kumar
Ranch Hand

Joined: Apr 15, 2002
Posts: 53
Hi,
In my design there are 3 packages..

suncertify.db
suncertify.client
suncertify.server


All the necessary classes for the rmi is in the suncertify.server package.
It works fine with the remote mode because of the dynamic code downloading.
Now if I try to connect through the local mode, my client requires the
suncertify.server package. so my client and server packages are tightly coupled
and this is because I've used a common interface (RemoteData which extends java.rmi.Remote)
for both modes.
or i can say that my client will not work without the server package.

Is this the right way to do that because now I feel that the client and
server pcakages should not be coupled in this way?
any suggestion will be appreciated.
Thank and regards
Manish Kumar
-----------------
-SCJP2
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Manish,
I guess it's all a matter of philosophy. No question if you can design an application with no dependencies that that's the way to go. However, that's almost never the case in the real world. I just imported both suncertify.db and suncertify.server and didn't worry about. If you think that it is important to decouple most of the client from those packages then you can probably use some sort of adapter class to do that. Of course the adapter will be dependant on those packages. You have to decide if it's worth the trouble.
Hope this helps,
Michael Morris
[ September 05, 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
George Lawniczak
Greenhorn

Joined: Aug 12, 2002
Posts: 27
My thought is that you should put everything associated with accessing the database into your db package. That includes your interface and both the local and remote implementations of that interface. This accomplishes several things:
1. You get the desired de-coupling between your client and server packages.
2. If you need to swap out the database, it's as simple as replacing the db package, it's all encapsulated into one package.
3. Reusability, your db access classes should be generic so that other applications could conceivably use those objects as well. The client and server packages are application-specific.
That's just my opinion, I could be wrong.
Manish Kumar
Ranch Hand

Joined: Apr 15, 2002
Posts: 53
Thanks, for clearing my doubts. Now i'll not put effort on changing my design.
regards
-Manish
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

It works fine with the remote mode because of the dynamic code downloading.

This is the only statement that you made that worries me.
dynamic code downloading requires a Web Server, the assessors will not have a web server, and then you application will not work.
You need to include your stubs with the client jar file, instead of using codebase/dynamic code downloading.
Good Luck
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Kruger Scheitz
Ranch Hand

Joined: Jul 31, 2002
Posts: 72
do we need to make the stub class to be downloaded automically ( dynamic class downloading ) or just copy the stub class into the client ??
friso dejonge
Ranch Hand

Joined: Jul 11, 2002
Posts: 162

do we need to make the stub class to be downloaded automically ( dynamic class downloading ) or just copy the stub class into the client ??

Some people copied it into the client. Or they just made the same db package available to client and server.
regards,
friso


swimming certificate (A & B), shoelaces diploma, and some useless java ones.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: coupling between client and server Packages.