Preconditions:
o != null
Tony Morris
Java Q&A (FAQ, Trivia)
Originally posted by Adrian Yan:
Wow, alot of good response. Just to clear something, I'm not against throwing Exceptions. I use it as well. I think that to me, it's more of how we should use it.
I'm not a language guru or a PHD in CompSci, but from my coding experience, I found Exception model is abit flawed. Most of us don't catch RuntimeException, but from reading error and exception from programs and libraries, NullPointerException is probably the most common one. Of course, this should never happened (in theory), but it does happened, and happens alot more than I think it should be.
If someone tells me RuntimeException is something JVM should handle, and not the responsibility of the programmer, I would laugh my ass off. If a customer uses my software, and he gets an error, and calls me, imagine the look on his face when I say, "errr... sorry dude, it's not my problem, it's Sun's problem!"
It is an error that is NOT an application error (e.g. not a calculation error) and is something that even if caught, makes the application unable to properly continue.
imagine the look on his face when I say, "errr... sorry dude, it's not my problem, it's Sun's problem!"
Tony Morris
Java Q&A (FAQ, Trivia)
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by Adrian Yan:
I don't understand the last post on RuntimeException. NullPointerException or IndexOutOfBound or Arithmetic exceptions are RuntimeException, therefore, compiler does not require it to be declare. This is where I believe causing a lot of problem.
Originally posted by Adrian Yan:
I don't like to extend RuntimeException unless I can't figure out anything better.
Howard Kushner<br />IBM Certified Enterprise Developer - WebSphere Studio Application Developer V5.0<br />IBM Certified Advanced System Administrator - WebSphere Application Server V5.0<br />IBM Certified Solution Developer - Web Services with WebSphere Studio V5.1<br /><a href="http://www.amazon.com/exec/obidos/tg/detail/-/1931182108/" target="_blank" rel="nofollow">Developing J2EE Applications with WebSphere Studio</a> my Certification Study Guide for IBM Test 287
RuntimeExceptions indicate there is a bug your code which needs to be fixed.
Using a RuntimeException just to "keep the code clean" is not a good idea, as you then lose the distinction.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by Stan James:
David, I'm not picking on you because I haven't solidly determined my own position on this, but be aware there are plenty of good brains who disagree. They say that the decision to build checked exceptions into Java was, in retrospect, a mistake from day one and other languages that have everything unchecked work out better in the long run.
So it takes a day for light to pass through this glass? So this was yesterday's tiny ad?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|