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.9 required=3.0 tests=BAYES_00,FROM_ADDR_WS autolearn=no autolearn_force=no version=3.4.5-pre1 Date: 7 Jun 93 18:43:27 GMT From: sgi!fido.asd.sgi.com!dblues!jackr@ames.arc.nasa.gov (John Jack Repenning ) Subject: Re: McCabe package for Ada? Message-ID: <1v028f$3g@fido.asd.sgi.com> List-Id: In article <1993Jun4.154720.23587@saifr00.cfsat.honeywell.com>, shanks@saifr00. cfsat.honeywell.com writes: > 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. Over large amounts of code, the correlation has been measured, and has been found to be high. I don't believe this invalidates the ideas here. Rather, it demonstrates that people tend to write code of a particular complexity density - why should that be surprising? The important question is, when you use the tools to learn a new style, do you produce code which is "better" in some way (such as having fewer defects, being easier to maintain, or being easier to verify)? I haven't seen any published research on this, by my own experience say the tools can indeed help many programmers develop better judgement and style. > I have a problem with high McCabe values as a necessary indicator of > procedure complexity/lack of maitainability. You should. No one should be telling you that this is a necessary (or sufficient) indicator. The claim is that it's a common indicator, that it ought to raise your suspicions: it's an aid to your good judgement, not a quick-fix. > (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. There really are cases where a string of conditionals are completely independent, and don't add to any real complexity; there really are cases where they interact in ways that make the superficially-simple code a disaster area. At the very least, this is an area where you should apply your judgement (as you have), and might well be justified in ignoring the numbers. "Essential" and "Design" complexity numbers attempt to count things that are more helpful in these situations, but you still have to treat them as warning flags, not gospel. > Should I care if the McCabe is high but the code is obviously not > complex and after exhaustive testing has no defects? Absolutely not. Just be convinced in your own mind as to why the numbers raised a false flag, just in case there really is cause for concern. Jack Repenning M/S 1-875 jackr@wpd.sgi.com Silicon Graphics, Inc. x3-3027 Off:(415) 390-3027 Visual Magic Division Fax:(415) 390-6056