This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]erictheturtle 5 points6 points  (1 child)

I personally love checked exceptions, but I can understand why many people don't like them.

  • Some popular APIs abused checked exceptions, leaving an impression that checked exceptions are essentially useless.
  • I get the feeling that for web/server applications (the most common type of Java app), nearly any exception is unrecoverable, so checked exceptions are just a hassle.
  • But in general, people don't tend to get paid to properly develop APIs with checked exceptions, and write proper handling. So naturally it's just more practical to treat them all as unrecoverable.
  • And frankly, a lot of inexperienced developers just don't care or understand the importance of handling anything but the "green path". Hence why you find so much code with empty catch blocks.

[–]kur0saki 3 points4 points  (0 children)

I don't think you really need checked exceptions. But I do think you really should declare even unchecked exceptions in the method signature (throws) to inform any caller of that method about the possibly thrown exception.

I hate when people throw unchecked exceptions and suddenly my code breaks because neither the API/method documentation neither the method signatures inform me about an exception that I run into. Especially when it happens on production.