Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In my experience, checked exceptions in Java just means most of your functions end up marked as throwing "Exception", or if you're more disciplined, throwing "MyApplicationBaseException" which is not really much better.

The reason why errors are better than exceptions is mainly that it is clear, when reading any function, what lines can fail, and what happens if they do. When reading a java function, you have no idea if half the lines in the function throw an exception. You might know the function as a whole can throw, but you don't know where execution might suddenly stop inside the function. You have to lean on the IDE to look at the definitions of all the functions this function calls, to see if they can throw, which is not something you can do when looking on github, or in a code review, or in an email notification for a commit.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: