aspose file tools*
The moose likes Java in General and the fly likes Exception Design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Exception Design" Watch "Exception Design" New topic
Author

Exception Design

Santhosh Kumar
Ranch Hand

Joined: Nov 07, 2000
Posts: 242
We have started new project and I need to design the application. I was thinking, what is the best design we can choose to meet the utmost performance requirement along with robust exception handling.
If you have any info, pl pass it on.
Mark Herschberg
Sheriff

Joined: Dec 04, 2000
Posts: 6037
Did I understand you right? You just asked, "how can I make a good design, and incorporate exception handling?" This is a really big question, and one that's not easy to answer.
It's also not J2ME related.
--Mark
Santhosh Kumar
Ranch Hand

Joined: Nov 07, 2000
Posts: 242
Sorry, if I had asked for lots in one question. Here is what I'm looking for. Good exception design guidelines keeping performance in mind. For ex., don't throw many exceptions, always write the stack trace into the log etc...
thanks
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

e.printStackTrace() doesn't count as handling an Exception
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
"Utmost performance" is not a reasonable requirement, because you can't say wether you have met it or not. Also, "utmost performance" inevitably comes with "utmost project costs", so it probably isn't what your client(s) really want(s).
And even when you have a more reasonable requirement (such as "has to process xxx in less than yyy seconds", for example), remember the Three Rules Of Optimization:
1. Don't.
2. (for experts) Don't - yet.
3. (if you really need to) Use a profiler to find the bottleneck - it isn't where you think it is.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
e.printStackTrace() doesn't count as handling an Exception
Maybe not, but (a) it's far better than catching an exception and doing nothing with it, which is what many novices end up doing, and (b) it's perfectly reasonable in addition to other actions. Logging exceptions doesn't preclude doing other things as well (including re-throwing the exception). And in any situation where you're not entirely sure yet what an appropriate response is, logging will at least give you ongoing reminders of what's really going on in your program.


"I'm not back." - Bill Harding, Twister
Max Habibi
town drunk
( and author)
Sheriff

Joined: Jun 27, 2002
Posts: 4118
As far as exception handling and logging go, you might find that jdk 1.4 offers some nice options, including exception chaining.
M


Java Regular Expressions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exception Design