|
I am so tired of all the comments singing the praise of checked exceptions on a theoretical basis. I dont care about whats good in theory!
Look over your code, look over the code of your peers. Look at the catch blocks. How many of them are just extra noise? How many of them ignore a potentially dangerous situation? How many of the simply wrap one exception in another exception? How many simply say this can never happen? How many contain bugs? How many are truly useful?
Now, look at the code in the standard library, books and articles. How many of these do you think actually improve the reliability and maintainability of the code? Look at the exceptions Sun decided to make checked. Look at CloneNotSupportedException, look at MalformedURLException, look at ParseException or UnsupportedEncodingException. Look at your code that deals with these exceptions. Are you happy that they were made checked exceptions?
Finally, take a look at the code base of the Spring framework. Is this unreliable code? This is the kind of code we will see if we get rid of checked exceptions. Its the cleanest, most reliable code in the Java Open Source ecosystem.
(from my blog)
In theory, checked exceptions is a good idea. In practices, it makes code less reliable. That is what experience will teach you. |