Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!wuarchive!cs.utexas.edu!rice!uw-beaver!fluke!mce From: mce@tc.fluke.COM (Brian McElhinney) Newsgroups: comp.lang.c++ Subject: Re: C++ Not Ready for Commercial Use Message-ID: <11859@fluke.COM> Date: 20 Oct 89 23:49:10 GMT References: <24.UUL1.3#913@acw.UUCP> <2169@dataio.Data-IO.COM> Sender: news@tc.fluke.COM Organization: Software of the Mist Lines: 22 In article <2169@dataio.Data-IO.COM> bright@dataio.Data-IO.COM (Walter Bright) writes: >Prog Anal: I always thought that most software metric analysis progs > were pretty worthless. Have you ever looked at the "McCabe Cyclomatic Complexity Metric"? I've found, for C code at least, that it does a very good job at finding error-prone portions of code. There is also a very convincing article in the Hewlett-Packard Journal (April 1989). Basically, the McCabe metric turns code into a graph, where each line of code is a node (the edges are the control flow between nodes). Applying some math from graph theory, you get a small integer number that "measures" complexity. From experience, a number greater than 10 is usually worth investigating/testing/redesigning/whatever. Unfortunately, I'm sure the McCabe metric is not going to be directly useful for C++ code. It is limited to the complexity of a single function. C++ gets complicated in the inter-relationships of methods, and of course, of classes. Methods are typically not very complex. Still, the same approach should be useful for "measuring" the complexity of a class or set of classes. Brian McElhinney "If always without desire, one can observe marvels; if mce@tc.fluke.com always desireous, one sees merest traces." Lao-Tzu