comp.lang.ada
 help / color / mirror / Atom feed
From: dog.ee.lbl.gov!network.ucsd.edu!swrinde!cs.utexas.edu!csc.ti.com!tilde.cs c.ti.com!mksol!strohm@ucbvax.Berkeley.EDU  (john r strohm)
Subject: Re: McCabe package for Ada?
Date: 4 Jun 93 22:07:47 GMT	[thread overview]
Message-ID: <1993Jun4.220747.26663@mksol.dseg.ti.com> (raw)

In article <1993Jun4.154720.23587@saifr00.cfsat.honeywell.com> shanks@saifr00.c
fsat.honeywell.com (Mark Shanks) writes:
>In article <daniC83348.MJ7@netcom.com> dani@netcom.com (Dani Zweig) writes:
>
>>It turned out that there was a 96% correlation between the Cyclomatic
>>Complexity of a module and the number of statements in a module.  The
>>link is that Cyclomatic Complexity is almost perfectly correlated with
>>the number of decisions in a module, the number of decisions is almost
>>perfectly correlated with the number of IFs, and the *density* of IFs
>>is quite consistent, with the result that the number of IFs is almost
>>perfectly correlated with the number of statements.
>
>As I understand it, the cyclomatic complexity - extended McCabes
>is a count of conditions (IFs, ELSEIFs, AND THENs, etc.) in a
>procedure + 1. I've verified this on a few (20-30) procedures. 
>But it seems you're concluding that the complexity metric would
>(could?) be correlated with the number of statements, and I
>haven't had that experience.

No, he said they MEASURED that correlation, using actuals from their
code.

>I see you are referring to a 
>COBOL/MIS environment; I'm using Ada.

As I read what he posted, he was in an environment that was using Ada to
do COBOL/MIS kinds of things.  Sort of doesn't matter: McCabe complexity
is not going to be affected significantly by Ada vs. COBOL.  (You have
learned my darkest secret: years ago, I learned COBOL, as well as the
more "mainstream" languages like Pascal, FORTRAN, LISP, Ada, and C.)

>>Needless to say, Cyclomatic Complexity turns out to be an excellent
>>predictor of defects -- by virtue of the fact that long modules average
>>more defects than short modules.  All of which is to say that people
>>who measure Cyclomatic Complexity probably aren't measuring what they
>>think they're measuring.  (McCabe's Essential Complexity has its own
>>problems, but it's a *somewhat* better measure of the 'messiness' of a
>>module's control structure.)
>
>Well, at the risk of appearing hopelessly inept, I have a problem
>with high McCabe values as a necessary indicator of procedure
>complexity/lack of maitainability. I have procedures that are
>logically grouped by function, for example, displaying aircraft
>brake antiskid failure messages. There are six possible messages,
>plus the condition of blanking the display for invalid data
>conditions. I am checking the status of 64 input parameters 
>(mostly Booleans) to determine which message/combination of messages
>should be displayed. (If XXXXXX and then YYYYY then...)
>Based on the nature of this McCabe metric, the count of IFs and
>ELSEIFs gets quite high very quickly, yet the code is quite
>simple to follow. I have the option of breaking this function up 
>into smaller procedures (this procedure has 186 logical lines of
>code), but that wouldn't make it any less complicated or more
>maintainable. Any suggestions? Should I care if the McCabe is
>high but the code is obviously not complex and after exhaustive
>testing has no defects?

Some twenty hears ago, Halstead (sp?) originated what came to be
called "software physics", but which we now call "metrics".  The air
was removed forcibly from their sails when someone showed that ALL of
their different measures, each one supposedly measuring some fundamentally
different aspect of program complexity, were strongly correlated with
each other and with number of source lines of code.

What this, and the McCabe measure, and the old-fashioned ruler test all
seem to say is that bigger modules TEND to be problem sources, and TYPICALLY
need more attention for quality, maintainability, reliability, and flavor.

Exceptions exist on both ends of the scale.  No metric is a substitute for
a functioning set of brain cells.

As for your particular procedure: if you currently have it partitioned
into one decision tree that calls one of a large handful of procedures,
then you have probably done all that you can.  The test is this: next week,
the systems engineers will come to you with a new special case that you
need to tack in.  How easy will it be to make the mod and test the modified
module?  If we repeat this five times (or fifty), what will the result
look like?

             reply	other threads:[~1993-06-04 22:07 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-06-04 22:07 dog.ee.lbl.gov!network.ucsd.edu!swrinde!cs.utexas.edu!csc.ti.com!tilde.cs [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-06-07 18:43 McCabe package for Ada? sgi!fido.asd.sgi.com!dblues!jackr
1993-06-05 19:29 David Boyd
1993-06-04 23:53 Kevin Sullivan
1993-06-04 21:44 Ala n R. Weiss
1993-06-04 21:25 Dani Zweig
1993-06-04 15:47 agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!math.ohio-state.edu!w
1993-06-04  6:24 Dani Zweig
1993-06-03 19:47 dog.ee.lbl.gov!network.ucsd.edu!sdd.hp.com!portal!lisburn!jaime
1993-05-27 17:55 Laurence VanDolsen
1993-05-26 22:42 David Boyd
1993-05-26 20:44 Wes Groleau X7574
1993-05-25 10:52 pipex!uknet!glasgow!unix.brighton.ac.uk!wjmc
1993-05-24 19:36 Alex Blakemore
1993-05-24  0:33 mole-end!mat
1993-05-19 23:04 David Boyd
1993-05-19 22:09 David Boyd
1993-05-19 21:18 agate!howland.reston.ans.net!darwin.sura.net!haven.umd.edu!news.umbc.edu!
1993-05-19 20:03 Wes Groleau X7574
1993-05-19 15:20 cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!howland.
1993-05-19  0:44 sgi!fido.asd.sgi.com!dblues!jackr
1993-05-18 23:42 David Boyd
1993-05-18 21:26 dog.ee.lbl.gov!overload.lbl.gov!agate!howland.reston.ans.net!ux1.cso.uiuc
1993-05-18 19:24 dog.ee.lbl.gov!network.ucsd.edu!usc!howland.reston.ans.net!europa.eng.gte
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox