Gosling Gong

Ranch Hand
+ Follow
since Jun 20, 2002
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gosling Gong

Can you explain how you handle the Exception?
21 years ago
Robin, I'd like to know when your JOptionPane shows, will your confirm booking dialog disappear?
did you do the booking in your confirm booking dialog?
Robin, did you use the default properties for each of your swing component?
Now I didn't set Look&Feel, and didn't set any font and color properties for swing components, I am not sure if it is OK?
21 years ago
Congratulations, Robin!
Could you guess what made you lost 2 points in the dcoumentation?
[ July 29, 2002: Message edited by: Gosling Gong ]
21 years ago
Congratulations, Bill!
Could you explain how you handle the exceptions and how you comment your code?
21 years ago
Could you explain your GUI and Exceptions handling?
did you use MVC in GUI, and did you chain the exception?
21 years ago

Originally posted by Rommel Carvalho:

Great comments and lots of them in the code. Nice, well understood implementation.

Thanks, Rommel!
Could you share your commentation experience with us, what kind of comments did you have? what did they mean saying lot of them in the code?
You did very well in Server side, could you tell how you handle the Exceptions?
21 years ago
About the exception in Client side, there are following options,
1) throw all the specific Exceptions all the way to the client GUI, in the GUI, just
catch(Exception e) { showMessage(e.getMessage()...}
2) throw all the specific Exceptions only in the Data interface implementation, but catch all the Exceptions in a Data service layer(or Facade), and re-throw a new DataException with friendly message.
3) similiar to the above, but make DatabaseException extends ChainedException
4) create client specific Exceptions such as FlightBookException, throw them in the data service layer(facade)
The idea that throw different exception at different layers is excellent, but I can not come up with a perfect implementation.

as to 2) 3), there will be such kind of code with every method in the Data Facade class
try {
} catch(RemoteException e) {
throw new DatabaseException("Remote Data Service Access Error");
} catch(IOException e) {
throw new DatabaseException("Remote Database Access Error");
} finally {
by the way, should I also catch the DatabaseException and the rethrow it with a new message like "Database Access Error"?
furthermore, do you think I should also include the messages generated by the caught Exceptions, like throw new DatabaseException("Remote Data Service Access Error:" + e.getMessage());
as to 4), I don't think it's necessary to have a new Client specific Exception class, because the exceptions used in client are only used to show a error message to the user, then, why bothering create new classes?
what are your opinions?
did you guys handle the case as
there is a comma in the value.
Hello, everyone!
I have some detailed questions on documentations,
1. should I put JavaDoc comments on private methods and instance variable?
2. what kind of comments did you put for the code? which should I use // or /* */?
3. shoule I comment on the deprecated methods, or only just need to delete the old one?
4. how did you make the javaDoc comments on the DataInterface, just copy it from Data and no comments on the LocalData and RemoteData?
5. continue with item 4, if i use LockManager, there is also lock method, should I comment it the same as Data?
6. How to comment a method which is composed by some other methods, for example,
public void lock(int recno) {
if(recno == -1) lockDatabase();
else lockRecord();
because the functional descriptions are already in the lockDatabase() and lockRecord, if I comment them again in the lock, is that redundant?
7. Did you modify the comments in Data class which has some obvious comment error, for ext.,
in lock comment, there is @param recno, but the actual argument for lock is lock(int record).
8. if I don't implement lock/unlock in the Data class, leaving the methods empty, should I change the JavaDoc comments that already there, or just don't care?
sorry for bring up so many trivial questions, but I think it is a good chance for us to learn documentation.
No one ever experienced such case?
Hello, ranchers!
I let my remote data implements unreferenced interface, but I found it behave strangely. I create a test client, which spawns 30 threads to bookFlight() for the same flight, it works.
after I commented the unlock(), off course there is only one thread get the lock, the others will wait. but after a period(less than 1 min), the unreferenced() in the remote data which was holding the lock was called.
I am confused why this will happen, I didn't close the client.
Anyone can show some light? thanx
I am also wondering what's the difference between your solution with someone else who passed. Because I saw some guys got high scores with the same layout of GUI, because in the marking criteria, it only states that,
User Interface (Total 24)
layout uses good/accepted Human/Computer Interaction (HCI) principles (24)
only two things
1) did you think your code clean and easy to read?
2) did you defend your GUI design properly?
About Documentation
did you provide all of the doc needed, readme, design choice, user's guide?
that means I have to set them for all the component I used? I readed the Java Look and Feel Guideline, but didn't find there is description on size, color etc.
by the way, how did you do it? did you set every component when create it?
Thanks, guys!
Eugene, I readed your code, but I am not sure how you release the Database Lock because you only have one flag databaseIsLocking, saying
1)client A lock record 1
2)client B lock database -1
3)client C lock database -1
4)client D lock record 2
5)client A unlock record 1
at this moment, I guess in your unlock, you simply call notifyAll(), how do you know how many client are waiting for Database locking so that you can set databaseIsLocking = false when all database locks have gone?
by the way, saying that one client want to lock two records at the same time,
1)client A lock record 1(assuming get lock successfully)
2)client A lock record 2(assuming waiting)
3)client B lock database -1
from you code, you will let client B lock the Database, but because the record locking is not empty, the client B has to wait for A release the lock, but A is also waiting for the lcok of record2(because the flag databaseIsLocking is true now), thus deadlock resulted.