4 ms·
I sometimes see people object to exception based control as you do here. I get it; it's essentially goto in diguise. But I've never read anyone discuss the pros
by le-mark 9y ago
I sometimes see people object to exception based control as you do here. I get it; it's essentially goto in diguise. But I've never read anyone discuss the pros and cons, or definitively call it out for what it is. Do you have any references on this topic?
- peoplewindow 9y agoExceptions for control flow are a performance problem in most environments. The JVM does a good job of optimising exceptions very aggressively but throwing one is a relatively expensive operation if the JIT compiler wasn't able to fuse the throw/catch together. It's a bit weird to use exceptions for control flow for this reason.
- jrs95 9y agoI don't, but the when exceptions become the norm it makes debugging much more difficult. I'm not an expert on the subject, but it seems to have a negative impact on performance as well. And in the case of a simple web app, it just shouldn't be necessary. Maybe it makes sense for Spring to do it, but that would indicate that it's more complex than it needs to be.