This sounds like a recipe for race conditions. Better to combine the check and the call; http://c2.com/cgi/wiki?SamuraiPrinciple . Exceptions are a language feature that anyone working in the language should understand; it’s perfectly legitimate to use them. The debugger argument is unconvincing; any debugger worth its salt will let you mask out particular exceptions.
I’d agree with you, especially since all these examples are in Java(ish?) and are absolutely asking for race condition. It is, however, important to be aware of the context. In a language with message passing and no shared memory, you get serialization of requests, so this rule of thumb applies very well. This is likely one of the reasons why exception handling in erlang tends to be pretty sane - never used for flow control and only used for exceptional conditions that arise.
This sounds like a recipe for race conditions. Better to combine the check and the call; http://c2.com/cgi/wiki?SamuraiPrinciple . Exceptions are a language feature that anyone working in the language should understand; it’s perfectly legitimate to use them. The debugger argument is unconvincing; any debugger worth its salt will let you mask out particular exceptions.
I’d agree with you, especially since all these examples are in Java(ish?) and are absolutely asking for race condition. It is, however, important to be aware of the context. In a language with message passing and no shared memory, you get serialization of requests, so this rule of thumb applies very well. This is likely one of the reasons why exception handling in erlang tends to be pretty sane - never used for flow control and only used for exceptional conditions that arise.