GeeCON Prague 2014*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Client/Server Design 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 "Client/Server Design" Watch "Client/Server Design" New topic
Author

Client/Server Design

Tongyu Wang
Greenhorn

Joined: Sep 10, 2002
Posts: 8
I just started the assignment and have been thinking about the overall architecture design and have some concerns. The requirements says:
"if two clients attempt to perform the sequence lock, read, modify, write, unlock concurrently, then both modification attempts will be handled correctly."
"To connect with your server, you should create a client program. This implementation should include a class that implements the same public methods as the suncertify.db.Data class, although it will need different constructors to allow it to support the network configuration. "
I understand the "lock, read, modify, write, unlock" sequence to ensure data integrity. But I think this should be done on the server side instead of the client side. The server should publish a business method like "bookFlight" and hide the lock(), unlock(), modify()... from the client. This approach could avoid the "orphan" locks problem by the client-side locking approach due to potential network glitch.
My concern is whether I will be penalized for not following Sun's instructions? Has anyone passed with this approach?
Thank.


SCJP, SCJD<br />"He who knows others is wise; He who knows himself is enlightened."<br />-- Lao-Tzu (6th century B.C.), Legendary Chinese philosopher
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Yes, because it is the basic approach that everyone takes. The use of a Facade class to hide the Data implementation from the client is the way to go. And it completely follows the requirements that are stated.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Whoa, Mark, are you talking about the same thing that Tony proposed?
Originally posted by tony wang:
I understand the "lock, read, modify, write, unlock" sequence to ensure data integrity. But I think this should be done on the server side instead of the client side. The server should publish a business method like "bookFlight" and hide the lock(), unlock(), modify()... from the client. This approach could avoid the "orphan" locks problem by the client-side locking approach due to potential network glitch.
My emphasis.
Tony, I would expect you to be penalized for this. You would be working around some problems that Sun wants you to work through. It goes completely against the requirement to have a client-side class that implements the Data interface. You'd also reduce the reusability of your server to, erm, well, zero.
- Peter
[ February 20, 2003: Message edited by: Peter den Haan ]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

No I didn't comment about him trying to do it on the server side, since in local mode there is no server to do it for him.
Mark
Tongyu Wang
Greenhorn

Joined: Sep 10, 2002
Posts: 8
I see your point. Thanks.
BJ Grau
Ranch Hand

Joined: Jul 10, 2001
Posts: 234
Wait a second Tony -
I think there is some confusion here. When I read your message I hear you saying that you are going to present the client with a remote object that has a high level business method like bookFlight.
If this is right, I would advise against it. Here is a recent thread discussing this and it also has a link to an even better thread.
Data methods exposed to client discussion
 
GeeCON Prague 2014
 
subject: Client/Server Design