Robert Klemme
9/10/2007 8:01:00 AM
2007/9/10, Advait Bellur <advait.bellur@yahoo.co.in>:
> I have a basic idea of what an exception is but I am not able to
> understand it so that I can make use of it in my application's.
> If possible please try and help me out with the basic of exception and
> its use.
>
> It would also be great, if any one of you could give me certain links on
> exceptions which would help me understand its concepts better.
Basically an exception signals a situation that cannot be dealt with
in the normal flow of operation (e.g. you are reading from a file and
the disk fails or the current method received invalid parameters).
Exceptions should not be abused for normal flow control (e.g. exiting
a loop).
Beyond those commonplaces it starts to get wiggly. There are many
people who have different opinions about what is an exception and what
not and I have seen heated debates about individual cases. One
general rule of thumb could be: if you find yourself returning a flag
indicating success or failure of a method then chances are that you
might rather want an exception for the failure case. As always, take
this with a grain of salt. :-)
Kind regards
robert