<story><title>Checked exceptions: Java’s biggest mistake (2014)</title><url>http://literatejava.com/exceptions/checked-exceptions-javas-biggest-mistake/</url></story><parent_chain><item><author>alasdair_</author><text>I like checked exceptions. Yes, sometimes (especially in the oldest APIs when they were still figuring this stuff out), they were overused but mostly I think they encourage developers to really think about what happens in the failure case.&lt;p&gt;I notice this especially with less experienced developers and remote calls - a lot of JS code I’ve reviewed in the past assumes the remote call will always work, yet Java code from the &lt;i&gt;same&lt;/i&gt; developer will almost always correctly handle the situation, simply because the exception is explicitly required to be handled.</text></item></parent_chain><comment><author>hota_mazi</author><text>Right.&lt;p&gt;They don&amp;#x27;t just &amp;quot;encourage&amp;quot; developers to consider error paths, they &amp;quot;force&amp;quot; them to do so.&lt;p&gt;The concept of checked exceptions is very sound, as is the more general concept of compiler enforced error checking. Very, very few languages have that (only Java and Kotlin in the mainstream league).&lt;p&gt;Languages with a solid implementation of algebraic data types offer a good first step in that direction but they still require users to manually bubble and compose monadic values, which introduces an unnecessary, and sometimes intractable, level of obfuscation and boiler plate.&lt;p&gt;All other languages provide weaker approaches to this concept that are library enforced, not language enforced, and therefore more prone to being overlooked since they require discipline from the developer.</text></comment>
<story><title>Checked exceptions: Java’s biggest mistake (2014)</title><url>http://literatejava.com/exceptions/checked-exceptions-javas-biggest-mistake/</url></story><parent_chain><item><author>alasdair_</author><text>I like checked exceptions. Yes, sometimes (especially in the oldest APIs when they were still figuring this stuff out), they were overused but mostly I think they encourage developers to really think about what happens in the failure case.&lt;p&gt;I notice this especially with less experienced developers and remote calls - a lot of JS code I’ve reviewed in the past assumes the remote call will always work, yet Java code from the &lt;i&gt;same&lt;/i&gt; developer will almost always correctly handle the situation, simply because the exception is explicitly required to be handled.</text></item></parent_chain><comment><author>AlexTWithBeard</author><text>&amp;gt; hey encourage developers to really think about what happens in the failure case.&lt;p&gt;It&amp;#x27;s a noble goal, but once I started thinking about what happens in the failure case, I came to the conclusion that checked exceptions are no help here:&lt;p&gt;- there are always unchecked exceptions. I found it useful to think that &lt;i&gt;any&lt;/i&gt; function might throw. So if extra reporting or graceful shutdown are required, just catch everything&lt;p&gt;- in most cases I have no idea how to recover from error: just keep throwing it to the caller until someone knows what to do. I want it to be the default behavior and I don&amp;#x27;t want to clutter my code with all the catch-wrap-rethrow boilerplate.</text></comment>