From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.0 required=3.0 tests=BAYES_40 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 9 Jul 93 12:35:48 GMT From: widget!brandon@uunet.uu.net (Brandon) Subject: Re: Ada and McCabe's Cyclomatic complexity Message-ID: <1993Jul9.123548.19525@evb.com> List-Id: parish@oti-hsv.com (Trace Parish) writes: >Hi Gang, >In a recent meeting where metrics were discussed someone stated (without >any backup) that McCabe's Cyclomatic Complexity was not a valid measure >for Ada. He left before I could find out why. Has anyone else heard of >this problem. It seems that since cyclomatic complexity is based on cycles >in a control graph (approx. by decisions + 1) that it would be just as valid >for Ada as for other languages. Is there some problem with tasking that I ~ References: I see no reason why McCabe is not a valid for Ada as any other language (;-) ). We use it often in our Testing Ada Software Course to help analyze White Box Coverage. Again, it is not perfect but is an easy model to teach and use. There are some places where McCabe needs specific attention under Ada. Particularly, in the case of exceptions with could unrealistically raise the apparent complexity of software. Also note, there was an article printed in Communications of the ACM (Dec 92, p. 17-19 that presents that the correct mathematical formula should be: V(G) = e -n + p + 1 not V(G) = e - n + 2 p. This is where e = number of edges n = number of nodes p = number of connected components Using this revised formula works much better with Ada since subprograms do not affect the complexity as much forcing some users to manual put code in-line to reduce the complexity In all honesty, McCabe's Cyclomatic Complexity does have some problems, since it does not (in original form) address data sensitizing and its level of coverage has been argued. I would be very interested in other forms that people are using to measure complexity. We have used both McCabe, LOC (5 kinds) and Halstead in our Complexity Measures Tool (CMT) and have found McCabe to be the second most widely used (Lines of Code as always is still the primary measure). We are looking into other metrics now and would appreciate any comments other people have had. It would be nice to bring some technical discussions to comp.lang.ada that would be worthy of crossposting :-) Brandon Goldfedder Director of Training and Consulting EVB Software Engineering, Inc. -- Freedom is doing what you like. Happiness is liking what you do. brandon@evb.com