PDA

View Full Version : Cyclomatic complexity and exception handling


=?ISO-8859-1?Q?Mika_M=E4ntyl=E4?=
02-05-2004, 04:18 AM
Hi,

Does anyone have ideas how to count cyclomatic complexity when
exceptions are involved? For example consider the following pseudo Java code

try {
class.mayThrowException(0);
class.mayThrowException(1);
class.mayThrowException(2);
}
catch (Exception E){
exception.handling();
}


In the code above, is the cyclomatic complexity 1, 2 or 3? Without
exception handling the answer would naturally be 1. With exceptions
involved I would say that the answer is 3. However, this means that
cyclomatic complexity increases every time there is call to a method
that can throw exceptions e.g. class.mayThrowException


Any opinions or information on the issue is appreciated.


Mika Mäntylä


MyLounge.com Site Map
Forum: Cars, Cell Phone, Database, Games, Home Improvement, IT, Music, School, Sports, Web Design, Web Server, Weight Loss

The MyLounge.com forum is intended for informational use only and should not be relied upon and is not a substitute for any advice. The information contained on MyLounge.com are opinions and suggestions of members and is not a representation of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for the accuracy, completeness or usefulness of any postings or the qualifications of any person responding. Please consult a expert or seek the services of an attorney in your area for more accuracy on your specific situation. Please note that our forums also serve as mirrors to Usenet newsgroups. Many posts you see on our forums are made by newsgroup users who may not be members of MyLounge.com Term of Service