Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!viusys!uxui!unislc!klb From: klb@unislc.uucp (Keith L. Breinholt) Newsgroups: comp.software-eng Subject: Re: WANTED: "C" code line counter program Summary: Keyword statements and Cyclomatic complexity anyone? Keywords: Cyclomatic Complexity, Keyword statements, Path Complexity Message-ID: <1991Apr5.153441.627@unislc.uucp> Date: 5 Apr 91 15:34:41 GMT Expires: 5/15/91 References: <1991Mar6.214157.18633@ntpal.uucp# <9082@suns6.crosfield.co.uk# <12630@pucc.Princeton.EDU> <1991Mar28.145235.14313@grep.co.uk> Sender: kbreinho@unislc.COM Reply-To: klb@unislc.UUCP (Keith L. Breinholt) Followup-To: Metrics bah-hum-bug... Organization: Unisys Unix Systems Group, Product Integration Lines: 41 In article <1991Mar28.145235.14313@grep.co.uk> frank@grep.co.uk (Frank Wales) writes: >4096 bytes on a line? Feh, kid's stuff. :-) > >Cases like this (fictitious or not) seem to me to highlight >the problems of metrics like "lines of code" or "statement >counts", because these are predicated on the notion that statements >or lines are uniformly complex, fundamental pieces from which >programs are built. It's hard for me to accept such a notion >for anything other than assembly language. Which is why a combination of measures is important. Lines of code is only meant to measure complexity due to size. Some other measures of size complexity are, number of unique identifiers, keyword statements, # of operators, ..... Measures of control flow complexity are McCabe's cyclomatic complexity or essential complexity, branch statement size (operators not characters) and so on. >Quite apart from the difficulties associated with inter-language >comparisons, is there any work on enumerating programs at the token >level, a sort of "component count" metric? This, at least, would >be an honest assessment of the fundamental syntactic pieces, >whatever that might be worth. (Yes, I'm a "metric sceptic".) Key word statements and unique or total identifier count is in the ballpark of what your talking about. Key word statements are if, then, else, while, do...and assignments (=) and function calls thrown in to round out other cases. Identifier counts are of the same idea but tries to measure more than the language specific identifiers. I have some tools to measure the above, they're in lex and took about a week to write. (search for identifiers and look them up in a table, or just count them). Keith -- ___________________________________________________________________________ Keith L. Breinholt hellgate.utah.edu!uplherc!unislc!klb or Unisys, Unix Systems Group kbreinho@peruvian.utah.edu