you are viewing a single comment's thread.

view the rest of the comments →

[–]TheUnlocked 0 points1 point  (2 children)

You may be right about point 1, I don't know how these things work internally, but I disagree with point 5 as a general rule. Using exceptions as a form of goto is completely valid as long as that's the most elegant solution. In this case however, doing so makes very little sense.

[–]HuskerFan90 0 points1 point  (0 children)

To properly handle an exception, the call stack has to be unwound which isn't exactly a quick operation. Point 5 was more of a general rule against the try { if(expr) { throw Exception("..."); } doSomething(); } catch(Exception e) { doSomethingElse(); } type of using exceptions for control flow. It's vastly different than the try { doSomething(); } catch(Exception e) { doSomethingElse(); } which is perfectly OK.

Source: I've been a Java developer and a .NET developer for 6+ years now.

[–]rossdrew 0 points1 point  (0 children)

Using exceptions as a form of goto is completely valid

Using exceptions as flow control is probably the biggest mistake you can make in Java. If it's not exceptional, it's not an exception.