Exceptions (Was RE: [ANN] Cleaned up KomHttpServer on SM)

Blake blake at kingdomrpg.com
Sat Nov 6 10:32:59 UTC 2004


On Fri, 5 Nov 2004 08:51:56 +0200, <goran.krampe at bluefish.se> wrote:

> A sidenote of interest: In Java you have the forced
> "throws/try/catch"-hysteria causing less experienced developers to
> sprinkle their code with more or less empty try-catches. That is very,
> very bad. Since Java forces you to either handle exceptions thrown by
> the lower layers OR declare that you also will throw them (unlike
> Smalltalk) this has the effect on developers that they, at least early
> on in development, tend to write empty catch-code because they "just
> want the damn code to compile and run".

How is it forced?

The Java system is not unlike the Delphi system (raise/try/except/finally)  
but you're never forced to use it. It simply provides a default graceful  
handling of exceptions. You add stuff in when you actually want to handle  
something differently (differently from displaying an error message and  
exiting the current routine while leaving the program running).

The net result is that you only handle exceptions when you feel like it;  
and it's pretty robust. People still misuse it, of course, but that's not  
the fault of the language.



More information about the Squeak-dev mailing list