supercat9 wrote:
On the other hand, it may not be possible to determine in advance all exceptions that might occur.
Of course not. In that case we wouldn't need exceptions at all... What I mean is: 'Foreseeable' in terms of business/application logic. If something totally unexpected happens (like e.g. the 'ObjectDisposed' you mentioned), there should be a general top level exception handler at the application level, but for sure such an exception must never be swallowed silently by the executing code. Not in a million years, in no circumstance whatsoever!
supercat9 wrote:
I don't particularly like -1 as a return value
Same with me, but in the case of my example -1
has a clear, discrete meaning that can de documented (less than 4 items -> computation not possible), while in the original snippet -1
means sth. went wrong (and I will never tell you what the problem was...). That's a huge difference - especially on large business-scale software projects, where you might have hundreds of such properties... Regards Thomas
www.thomas-weller.de Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Programmer - an organism that turns coffee into software.