News for hackers. Stuff that matters.
Re:Isaacs: try/catch is an anti-pattern by AndrewDucker on Monday November 14, 2011 @05:47AM (#3233566)
I think that having alternatives to try/catch is generally worthwhile. Exceptions should only be thrown in exceptional circumstances.

So (to take some C# code as an example), I'd only call int.parse(myString) if it really, really should only get called when myString contains something that's parseable to an integer.

If it just probably contains an integer, then I'd call int.TryParse(myString, out returnedInt), and check the boolean return to see whether it was valid.

There are no comments on this comment yet.