Favored Language for Network Enabled Apps.
dave at thesmithfam.org
Mon Oct 29 15:10:36 MDT 2007
Bryan Sant wrote:
> That's going away in Java 7. No more checked exceptions.
> However, remotes calls would be a good case for a checked exception.
> I'll let you in on a little secret... The network... It isn't
> reliable. Yes, I know you're stunned. But sometimes the network
> connection fails for various reasons, thus you SHOULD handle that
> exceptional execution path.
I agree that the network is unreliable (of course). But I disagree that
every time I call a remote method, I should have to catch an exception.
Network errors should be handled in one place, not at every function
call. If there's a way to do that with Java RMI, I'd like to know about
it. If you have dozens of RMI methods, your code gets bloated in a
hurry, and you write more exception handling code than actual
implementation. C++ CORBA suffers from the same problem (at least
omniORB does), and it makes it miserable to call a CORBA function, when
it's *supposed* to be network transparent. Wouldn't it be great if you
could specify one exception handler for a whole batch of method calls
without having to spell it out at each call? Maybe that's a good case
I like Java's checked exceptions. To me, it's what makes them useful.
C++ exceptions are basically useless because the compiler does not force
them to be caught. Why did Sun decide to ditch them in Java 7?
More information about the PLUG