Hi Folks. I have an "observation" to make regarding the guidance on exceptions in the Java Tutorials (link below), and would be interested in the thoughts of others. I will keep this short and to the point. The page ends by stating..
"Here's the bottom line guideline: If a client can reasonably be expected to recover from an exception, make it a checked exception. If a client cannot do anything to recover from the exception, make it an unchecked exception."
I am struggling with this statement. Surely there is ALWAYS something a client can do to recover from any exception - be it checked or unchecked. For example if the client receives a runtime exception such as a NullPointerException because some service went down unexpectedly then the client could ultimately return a message like.. "The XYZ service is down. Please contact Operations blah blah.." We humans are capable of putting a man on the moon, so surely we can do something as simple as recovering from a runtime exception! Product managers and developers need to get together, and think outside the box to understand all the possible problems which could occur with their functionality at any time, and build in a means for recourse.
Unchecked Exceptions The Controversy (The Java™ Tutorials > Essential Java Classes > Exceptions) (0 Bytes)