A Sample Measurement
Table 8-1 contains a summary of all the metrics used in this study, and the symbols denoting these metrics in the rest of the tables and figures.
Table 8-1. Selected metrics for the study
Variable | Metric (symbol) |
---|---|
Size | Source Lines of Code (SLOC), Lines of Code (LOC) |
Number of C functions (FUNC) | |
Complexity | McCabe’s cyclomatic complexity—maximum of all functions (MCYCLO) |
McCabe’s cyclomatic complexity—average (ACYCLO) | |
Halstead’s length (HLENG), volume (HVOLUM), level (HLEVE), and mental discriminations (HMD) |
The elements of code that provide input to all these metrics are illustrated in the
sample source code file shown in Example 8-2. This file was extracted from the
package
urlgfe
, a cross-platform download manager. (urlgfe
has recently changed its name to uget
, so it is no longer found in the ArchLinux repositories
with its original name.) The file contains preprocessor directives (such as ), comments (such as ), and
only one function (starting at line ) containing a while
loop.
Get Making Software now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.