You might want to read what Bruce Eckel has to say about checked exceptions. The short version: checked exceptions sound better than they actually are.

In my experience, having a robust test suite is a great way to go. If a programmer misses something, write a test to verify the bug by watching the test fail, fix the bug, rerun the test and make sure it passes. Gradually over time, you can build a nice test suite which is going to cover the problems you face.

With checked exceptions, a programmer who's under the gun might stub out some exception handling code and then later forget to flesh it out. It's a natural problem, but checked exceptions can lull you into the false belief that you're really handling those issues.

For other readers unclear on this: think of a checked exception as something that can fail forcing you to wrap it in an eval at compile time and then testing the result:

eval {$some->method}; if ($@) {};

If you were forced to do that at compile time, you might see a lot of stubbed out error checking like I demonstrated. In Java, it's something like this:

try { some.method(); } catch (DealWithThisExceptionLater e) {}

Personally, I'd feel much more comfortable with a nice test suite that I can build on rather than littering the actual code with stuff that I might never need.

Cheers,
Ovid

New address of my CGI Course.


In reply to Re: Enforcing exception catching by Ovid
in thread Enforcing exception catching by dmitri

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.