McCabe complexity



I was just running mlint with the '-cyc' option to look at
the cyclomatic complexity of my code. I tend to break
things up fairly well into smaller subfunctions, and most
of them give me values in the range of 1-10. However, I
noticed that the subfunctions which routinely gave me
values of 25-40 are those with big switch statements,
either containing a few cases with a lot of code, or a lot
of one-line cases.

It seems clear that the McCabe complexity measure doesn't
like switches all that much, unless they're tiny and
simple. Is this anything other people have seen? Should I
be concerned about this? In other words, are there
better/more efficient ways I should be doing things that
don't involve switches? (Although I'm not sure how I would
do away with them).

Or maybe this is just one of many subjective complexity
measures that I just shouldn't worry about? What are
everyone's thoughts?

Ken
.



Relevant Pages

  • Re: Need Help in Function Point Metric and Cyclomatic Complexity
    ... > III. Algorithms ... > Unlike the standard IFPUG function point metric, ... > Cyclomatic complexity ... Essential complexity is derived from cyclomatic complexity. ...
    (comp.software.measurement)
  • Need Help in Function Point Metric and Cyclomatic Complexity
    ... Algorithms ... Unlike the standard IFPUG function point metric, ... Cyclomatic complexity ... Essential complexity is derived from cyclomatic complexity. ...
    (comp.software.measurement)
  • Re: How to develop a random number generation device
    ... and complex software systems never are. ... cyclomatic complexity of 100's of interacting state machines is on ... In the memory there is much ...
    (sci.electronics.design)
  • Complexity metrics for Oracle applications?
    ... Can anybody point me to some good references or resources on software complexity measures that work well for Oracle applications - that is dealing specifically with stored procedures, SQL, data model, schema model and so forth? ... Also I would appreciate correction if I'm off base here, but I'm not sure how applicable something like cyclomatic complexity would be in this case, especially since SQL itself is not particularly oriented around procedural flow. ...
    (comp.databases.oracle.server)