Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I suppose that dynamic exception checking is just another name of firing exceptions at run-time.</p> <p>Although I believe in static exception checking, Java way of static exception checking really has problems that concern interface implementations.</p> <p>Say, we have <code>IParser</code>. What appropriate exceptions its method <code>parse()</code> may throw? Possibly <code>SyntaxErrorException</code>. Now we want a <code>ServerResponseParserFromURL</code> to be used in such a way:</p> <pre><code>class ServerResponseParserFromURL implements IParser { .... }; .... try { IParser parser = new ServerResponseParser(new URL("http://example.com/test.htm")); parser.parse(); .... } </code></pre> <p>Here is the problem &mdash; the implementation of <code>IParser</code> may fire, say, <code>NoRouteToHostException</code>. So we can not use nice and concise form and need to fallback to long form:</p> <pre><code>class ServerResponseParser implements IParser { .... }; .... try { String response = getServerResponse(new URL("http://example.com/test.htm")); IParser parser = new ServerResponseParser(response); parser.parse(); .... } </code></pre> <p>As you see, in practice, our <code>IParser</code> is <code>IStringParser</code>, not the generic <code>IParser</code>.</p> <p>Although it may be tolerable in this particular case, it complicates things when we want to supply an <code>IParser</code> as one of arguments of a function <code>f</code>. Say, to be able to parse response of url-identified server, we can not just feed <code>ServerResponseParser</code> object and url &mdash; we need to find a way to feed <code>getServerResponse</code> method to <code>f</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload