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 About doc and exception 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 "About doc and exception" Watch "About doc and exception" New topic
Author

About doc and exception

Ray Cheeny
Ranch Hand

Joined: Aug 21, 2002
Posts: 74
Hi,
1>
javadoc style comments must be used for each element of the public interface of each class

What does it mean?
Need I comment all the classes and methods?
When I use javadoc ,should I comments all the methods ?
2>I have a TextArea which will show the excepions in the user interface and I will still throw it to the MS-DOS,too.Is that right?
If there's exception occured in server,how should I to catch it?Show a Dialog or just throw it?
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Ray,

What does it mean?
Need I comment all the classes and methods?
When I use javadoc ,should I comments all the methods ?

Well that's a good question. What it means in the strictest sense is that all public identifiers, methods and variables must be javadocked (still not sure abou that word ). I javadocked everything but I lost a point on documentaion so who knows? I feel that at the very least, you should javadoc all public and protected identifiers.

2>I have a TextArea which will show the excepions in the user interface and I will still throw it to the MS-DOS,too.Is that right?

I didn't and don't really see any point in throwing back to the shell. Just let the user know in the GUI.

If there's exception occured in server,how should I to catch it?Show a Dialog or just throw it?

If you have a server GUI, then do it the same way you did in the client. If not then wrap the exception with a meaningful message and throw it back to the shell.
Hope this helps,
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
Ray Cheeny
Ranch Hand

Joined: Aug 21, 2002
Posts: 74
Hi Michael,
I have almost come to the end of my Developer Assignment.But some places have a little confusion.
As what you have told me I would javadoc all the methods .
About the exception,when I catch the exception,should I use the e.printStackTrace() or
System.out.println(e)?I think the latter is better,for the formmer print too many messages and
is not suitable for user to see those.How do you did it?
If not then wrap the exception with a meaningful message

What is the meaningful message?
Do you mean when an remoteException is throwed,I should tell user a string like "Cannot connect to the server" instead of "java.net.connectionException...."?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Do you mean when an remoteException is throwed,I should tell user a string like "Cannot connect to the server" instead of "java.net.connectionException...."?

Yes he does mean that.
I would use e.printStackTrace() but only for my debugging, you can still have that display in the console window. But the best solution for exceptions displaying to users is through a simple JOptionPane window in Swing that pops up and gives a nice pretty easy to understand message, like the one you said above.
If you don't have a GUI for the server, which is fine, you will probably use e.printStackTrace to the servers console window.
Good Luck
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About doc and exception
 
Similar Threads
URLyBird Question - DB Design
Javadoc question and exception question
B&S: What types do you comment with javadoc?
[URLyBird] Javadoc comments
Disallowed to use private inner classes?