4 ms·
If you need an exception here, you're just a bad programmer. It's your fault you didn't explicitly check that the lock was functional before poking that lion! /
by hackinthebochs 14y ago
If you need an exception here, you're just a bad programmer. It's your fault you didn't explicitly check that the lock was functional before poking that lion! /s
- xionon 14y agoBut sometimes it's not just the programmer that gets bitten, it's all the other people at the zoo, too. Exceptions help protect everyone.
- Quarrelsome 14y agoSure but are you telling me you always work on teams where everyone is shit hot? If you write a library are you thinking that everyone is going to use it properly? My point is that exceptions help people to learn how to use APIs (its kinda like documentation that appears through use!) and exceptions make things _safer_. I appreciate you could write the above in two try catches but my point is that it would look more wrong. The code above _looks_ fine and that's my point.
- hackinthebochs 14y agoHah, I guess my post could have used a sarcasm tag :) I totally agree that exceptions are far superior than checking return values.