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: 3 Jun 93 19:47:21 GMT From: dog.ee.lbl.gov!network.ucsd.edu!sdd.hp.com!portal!lisburn!jaime@ucbvax.Be rkeley.EDU (Jaime Cordera) Subject: Re: McCabe package for Ada? Message-ID: <1993Jun3.194721.23315@vertex.com> List-Id: >|> LOOP >|> "Hmm, I'm gonna need to make a decision based on these two fields sometim e >|> further down the file, so I'll check the condition now and throw the >|> answer into this boolean (or enumerated, or integer) variable." >|> "OK, now I need to loop the number of times I saved in...which scratch >|> variable did I put that in?" >|> "And inside this loop I need to create and save another control value >|> for the decision in the exception handler..." >|> "Now I need a case statement on the variable I assigned by calling that >|> subprogram back there ... >|> [ more of the same ] >|> exit LOOP and hope it works when I can no longer figure out where I am... >|> END LOOP >|> >|> If I had a nickel for the number of times somebody said "I don't know why >|> I did that. Must be needed somewhere else." ... > > I am not certain about how my response above got fitted with the >situation that Wes is writing about, it was intended to go with different >posting. (I probably screwed up and followed up the wrong article). > > In any case, I also dread the type of code that Wes is talking >about. In the case Wes is talking about the metric needed is the cyclomatic >complexity of a module in relation to some set of data elements. Basically >it would be a count of the number of paths through the the module which touch >one or more of the data elements. For data elements local to the module, this >would be very tough to automate computation of since you would only >care about some sub-set of the local variables (i.e. you really don't care >much about loop counters) and choosing that subset would require examining >the software. I would look at values of this number which were close to or >equal to the modules total cyclomatic complexity as being an inditcator that >something might be wrong. In any case, this type of situation is again >very tough to detect automatically. About the only thing that can be done ^^^^ ^^^^^ ^^ ^^^^^^ ^^^^^^^^^^^^^ I'm not sure I understand the situation completely, (or the metrics) but in the example above one of the problems was a lack of locality of reference. This is rather routinely calculated in optimizing compilers (called the use-definition tree). They want to know when they do and don't need to have space for a variable (especially when the variable lives in a register). The compiler calculates this data for it's own uses, but the information is there and could be massaged for purposes of producing metrics, or warning messages, if that's desirable. In fact, for the compiler, widespread uses of a variable in some cases might as well be separate variables, but to the human eye it's not apparent(which is the problem, of course). I'm not a metrics person at all, but I know something about compilers. I hope this helps. Is there some part of this discussion I didn't follow ? Jaime "Former Compiler Guy" Cordera > >-- >David W. Boyd UUCP: uunet!sparky!dwb >Sterling Software IMD INTERNET: dwb@IMD.Sterling.COM >1404 Ft. Crook Rd. South Phone: (402) 291-8300 >Bellevue, NE. 68005-2969 FAX: (402) 291-4362 -- ----------------------------------------------------------------------------- Jaime Cordera jaime@vertex.com Vertex Semiconductor (408)456-8900x2337 A Toshiba Subsidiary