3 ms·
I make the following observation: Everybody I've seen arguing in favor of checked exceptions in the past couple of years have argued about their theoretical ben
by jerf 17y ago
I make the following observation: Everybody I've seen arguing in favor of checked exceptions in the past couple of years have argued about their theoretical benefits. Everybody who is arguing against them have argued about how they have not worked out in real life.
This pattern seems to recur a lot in programming debates, where people don't seem to realize that it doesn't matter how wonderful your theory is if when you try it out, it's wrong. That's where checked exceptions are.
The time for theorizing about their effects on programs is long, long past. Who cares whether they theoretically force programmers to write better code? We now know that in reality, it actually results in worse programs the majority of the time. When theory and reality disagree, theory is wrong. Why anybody still talks about their theoretical design goals is beyond me.
As near as I can tell, the debate is over if you ignore the people who haven't let their theories catch up to reality. If someone's got a success story posted about how checked exceptions saved their program's bum, I'm interested in the link, but I haven't seen one.
(I say it that way because when you have something enough people will read you can always find someone to pop up and claim that "X is good", but I'm specifically asking for arguments that already existed prior to this post, to avoid selection bias effects.)
- barrkel 17y agoFirst up: I'm not a fan of checked exceptions. But on the other hand, I must point out: checked exceptions certainly force you to address the issue of the exception being thrown, and as a result, the failure mode that they prevent can't occur, so the evidence you're seeking is more or less impossible. On the other hand, checked exceptions have their own failure modes, down to human behaviour: rather than having to rewrite every method declaration on the call graph to throw the appropriate list of exceptions, some bad apples just catch exceptions and do nothing with them. This shuts up the compiler, but harms product quality. IMO, the theory behind checked exceptions is actually fundamentally mistaken. Exceptions aren't much good if you're constantly trying to catch them. Exceptions work best if you write your code in a transactional style, more or less assuming that an exception can occur at any moment, on any operation. This can be tricky: it can force you to make or keep copies of structures when doing large structural modifications; but this difficulty is not strictly due to exceptions, as failures modes need to be dealt with in any case.