Give me some of your thoughts on which is a better coding practice/makes more efficient code/looks prettier/whatever: Increasing and improving your ability to use if statements to anticipate and catch potential problems? Or simply making good use of try/catch in general?
Let's say this is for Java (if it matters).
Edit: I'm presently transitioning myself away from some admittedly out-dated and constrained current coding practices, but I'm a little torn on the necessity of doing so on a few points (such as this). I'm simply asking for some perspectives on this. Not a debate.
this debate (2003) was good:
http://www.joelonsoftware.com/items/2003/10/13.html
http://nedbatchelder.com/blog/200310/joel_on_exceptions.html
if
blocks are slightly faster; if you aren't going to need a dozen of them, they're a better idea than try/catches
. Exceptions should be exceptional, not every time the code runs. I use Exceptions for rare events like server disconnections (even though they happen a few times every day), and if
blocks for any of my controllable variables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With