CS 435 - Week 13 Lecture 1 - 2014-04-22

Metrics... (from Jalote Ch. 7)

*   LOC, KLOC
    *   Jalote mentions a standard definition:
        non-comment, non-blank lines
    *   often: generally? only new or modified lines
        are counted
    *   heavily used, although it has shortcomings

*  another size metric: Halstead's Volume
   *   proposes: basing metrics on the number
       of OPERATORS and OPERANDS
   *   n1: number of distinct operators
   *   n2: number of distinct operands

   *   N1: total occurrences of operators
   *   N2: total occurrences of operands

   *   Vocabulary n of a program: n = n1 + n2
   *   Length N of a program: N = N1 + N2
   *   Volume V = N log2 (n)

       *   "represents the minimum number of bits
           necessary to represent the program"

       *   but this is considered a size metric;

       *   experiments have shown Halstead's volume
           is highly correlated with the size in
	   LOC?!

*   some COMPLEXITY metrics:
    cyclomatic complexity
    *   perhaps the most widely-used measure?
    *   rep. program as a control flow graph

    *   nodes n: decisions
    *   edges e: where control can transfer based on
        a decision
    *   p: connected components

    *   cyclomatic complexity:
        V(G) = e - n + p
        which can be shown to be the same as:
	*   number of linearly independent cycles in the
	    graph
        which can be shown to be the same as
	*   number of decisions in the program plus 1