On Thu, Mar 24, 2011 at 11:03 AM, Reinier Zwitserloot <[email protected]> wrote: > (A) For any method that would ordinarily return void, this boils down to > C-style "return error codes". I pray I don't have to explain why this is far > far worse compared to exceptions (of either checked or unchecked variety).
Give me an example of a void method that has a checked exception that isn't usually dealt with in the "wrap and throw" style. > (B) Where you can get away with returning maybes/options, you're making it > much harder for code to decide to defer the handling of this error condition > to something up the chain. It's also infectious - if as part of doing your > thing you could run into errors, then you have to turn whatever you return > into an Option/Maybe guard as well. At some point virtually every method > returns option/maybe. How is it harder now? Especially when you usually have getOr methods on the Option types. (That is, Option<A> typically has a getOr(A) that will return what it holds or an alternative value. Couple this with a getOrThrow(Exception) and you can easily decide right there exactly what you will do if you didn't get the value. Or even better, couple Either with some amazing abstractions out there and suddenly the problem is much easier to reason about.) Correct me if I'm wrong, I don't think any language (that has been brought up) has completely done away with exceptions. Just checked ones. > (C) You don't solve the problem of "where do we draw the line?" - when does > an exception become sufficiently unlikely that you're better off making it a > checked exception? The same question applies to: When do we return Option > and when do we not? You're not solving any problems here. I'm still waiting for examples of some good usages of checked exceptions. -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
