seeking clarifications structuring formula devaluate cyclomatic complexity
recently the association started measuring cyclomatic complexity (cc) functions the formula weekly basis, observant functions have softened worsened. have started profitable lot some-more pleasantness cc functions.
i've review cc informally distributed 1 + array preference points duty (e.g. statement, loop, name etc), also array paths by function...
i know easiest proceed shortening cc mislay slight refactoring repeatedly...
there somethings i am capricious about, e.g. cc following formula fragments?
1)
for (int i = 0; i < 3; i++)
console.writeline("hello");
and
console.writeline("hello");
console.writeline("hello");
console.writeline("hello");
they both same thing, nonetheless does initial chronicle have aloft cc since statement?
2)
if (condition1)
(condition2)
(condition 3)
console.writeline("wibble");
and
if (condition1 && condition2 && condition3)
console.writeline("wibble");
assuming libel does short-circuit evaluation, such c#, following twin formula fragments have same effect... nonetheless cc initial bit aloft since 3 preference points/if statements?
3)
if (condition1)
{
console.writeline("one");
(condition2)
console.writeline("one two");
}
and
if (condition3)
console.writeline("fizz");
if (condition4)
console.writeline("buzz");
these twin formula fragments opposite things, nonetheless have same cc? does nested matter initial bit have aloft cc? i.e. nested statements mentally some-more challenging understand, nonetheless reflected cc?
Comments
Post a Comment