if statements VS try catch blocks

Feb 5 2007 2:15 PM

What is the best practice?  What is the most fast?

Is it a good practice to base your applications on exceptions and therefore throwing exceptions and handling them when appropriate rather than making a lot of if statements to check the state of objects before performing a particular algorithm?

if statements are quite heavy on the processor if I'm not mistaken while try catch blocks lock parts of the code.. am I right?  Using try catch blocks and exceptions you could save some code (if statements here and there) whilst by using exceptions you would go straight to the point and if an error occurs you just handle it in a general fashion.

Any help?

Aaron


Answers (2)