1. I accept that I am under the control of a higher power (Muppet).

### great coding anecdote (via reddit)

http://codecraft.info/index.php/archives/81/
\$--
March 30th, 2007 6:14am
"cyclomatic complexity" - thanks for making my head explode.
Bluebeard
March 30th, 2007 6:24am
What's cyclomatic complexity, programming washing machines or something?
el
March 30th, 2007 7:07am
I remembered it as "cyclometric complexity" and thought you were all nitpicking on the spelling.

It's a useful concept. If a function gets cc > 10, think about refactoring.
\$--
March 30th, 2007 7:15am
Refacotring? I've got lurking to do on forums
March 30th, 2007 7:17am
So basically splitting it out into two low temperature washes is better than one high temperature?
el
March 30th, 2007 7:28am
>> If a function gets cc > 10, think about refactoring. <<

A couple of jobs ago, we had a method that was a 54.
*That* was a scary method to maintain.
xampl
March 30th, 2007 9:52am
of course, it can be misleading, like long switch cases and so on. but then a dispatch table is often a better way, anyhow.
\$--
March 30th, 2007 9:55am
how do you calculate Cyclomatic complexity?

the post suggests a few minutes with perl and i could have per function Cyclomatic complexity? Any help?
bob
March 30th, 2007 11:26am
> how do you calculate Cyclomatic complexity?

He aint gonna tell you. That's how he gets the big bucks.
strawberry snowflake
March 30th, 2007 12:10pm
No, it's actually very simple.

Start at 1.  Then add one for each "IF".  Add one for each "ELSE".  If you get a 'case' or 'switch' statement, add one for each.  Add one for each WHILE/REPEAT/.

That's it.  Cyclomatic complexity -- the number of decisions made in a module.  Or, the number of 'loops' in the decision tree.

McCabe makes his money off selling software that will do this for entire systems of software.
SaveTheHubble
March 30th, 2007 12:44pm
The AVERAGE complexity was 43?  The good guy's was 22?

That place must be a nightmare.  I wonder what the highest was.
Lurk Machine
March 30th, 2007 1:52pm
The danger in paying too much attention to Cyclomatic complexity, is that you end up with a zillion methods that don't accomplish very much.

I would say something between 12 and 20 is about right.
xampl
March 30th, 2007 2:04pm
one would think there would be an eclipse plugin. the tools for this are pretty trivial (perl). I do wonder how cc deals with class hierarchies.
strawberry snowflake
March 30th, 2007 2:56pm
"The danger in paying too much attention to Cyclomatic complexity, is that you end up with a zillion methods that don't accomplish very much. "

provided that the things they do are useful by themselves, I'd say that that is a good thing.
\$--
March 30th, 2007 5:56pm
"Refacotring?"

That's where the members of this board sit in a big circle and pass the weed around.

Sometimes the circle is called a cyclomat.
Practical Economist
March 30th, 2007 8:29pm