On Dec 17, 2006, at 9:02 PM, Randy W. Sims wrote:

Matisse Enzer wrote:
On Dec 15, 2006, at 10:13 PM, Chris Dolan wrote:

OK, I see. Perhaps I was distracted from your main point by mention of cyclomatic complexity, which has a rather specific definition.
Mea culpa.
In the next release I will change the documentation for Perl::Metrics::Simple to make clear how exactly the complexity score is calculated, and that it is only an approximation of true cyclomatic complexity. Meanwhile, I am open to making the measurement more useful. For example, should
    if ($a eq $b)
or
    if ( $a == $b )
be counted as more complex than:
    if ( $a )
?

I don't think so. The latter is simply an implicit version of the former. It means something like:

  if ( $a == $true_value || $a eq $true_value )

Another way of looking at it is that comparison operators are no different than any other expressions.

 if ( func() )
 if ( --$a   )

The expressions themselves do not represent branches. They just produce values that may be used as the basis for a branch.

I agree that ( $a == $b ) is not an extra branch, but, it is harder for a human to understand than
  ( $a )

I think that for true Cyclomatic Complexity ($a==$b) is the same as ($a) but there is some other thing going on with ($a == $b) that perhaps, should be considered some other kind of complexity.

-------------------------------------------------------
Matisse Enzer <[EMAIL PROTECTED]>
http://www.matisse.net/  - http://www.eigenstate.net/



Reply via email to