Y'all are a bunch of wankers!

great coding anecdote (via reddit)

http://codecraft.info/index.php/archives/81/
Permalink $-- 
March 30th, 2007 6:14am
"cyclomatic complexity" - thanks for making my head explode.
Permalink Bluebeard 
March 30th, 2007 6:24am
What's cyclomatic complexity, programming washing machines or something?
Permalink 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.
Permalink $-- 
March 30th, 2007 7:15am
Refacotring? I've got lurking to do on forums
Permalink what are you reading for? 
March 30th, 2007 7:17am
So basically splitting it out into two low temperature washes is better than one high temperature?
Permalink 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.
Permalink 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.
Permalink $-- 
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?
Permalink 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.
Permalink Send private email 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.
Permalink 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.
Permalink 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.
Permalink 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.
Permalink Send private email 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.
Permalink $-- 
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.
Permalink Practical Economist 
March 30th, 2007 8:29pm

This topic is archived. No further replies will be accepted.

Other topics: March, 2007 Other topics: March, 2007 Recent topics Recent topics