The corollary to the adage "You can't manage what you don't measure" is "What you choose to measure will control where you focus and what you improve". Software metrics have been proposed for measuring many, many different aspects of an existing body of source code. Some of these metrics, such as Lines of Code and Comment Ratio, have a fairly obvious meaning and use; most are less self-explanatory. The following are some of the most significant and useful software metrics of the latter type.
McCabe Complexity MetricsIn his paper A Complexity Measure, IEEE Transactions on Software Engineering, Dec 1976, Thomas McCabe defined a set of metrics to characterize the complexity of a software module's internal control flow logic. Glen Myers suggested a revision to the calculation in An Extension to the Cyclomatic Measure of Program Complexity, SIGPLAN Notices, Oct 1977. Cyclomatic Complexity (v(G))
Woodward, Hennell and Hedley Knots MetricFollowing McCabe's publication of the Cyclomatic Complexity metric, some in the field, such as Myers and Hansen, continued and refined McCabe's focus on token counts. Others, including Woodward et al, looked to measure the internal structure of a module. In 1979, the Knots metrics was published as A Measure of Control Flow Complexity in Program Text Knots (k)
Welker Maintainability IndexThe combination of multiple metrics into a single indicator of relative maintainability of a body of source code was originally defined by Oman and Hagemeister. Empirical studies by others led to a series of variants, and calculation of the maintainability index evolved over several years. Welker's 1995 proposal with Oman has evolved slightly into today's most widely used definition. Maintainability Index (MI)
Chidamber and Kemerer Object Oriented MetricsAs a way to characterize the "object-orientedness" of a design, a suite of metrics was proposed by Shyam Chidamber and Chris Kemerer in their 1994 paper, A Metrics Suite for Object-Oriented Design. The six metrics are: Weighted Methods Per Class (WMC)
Halstead Complexity MetricsA pioneer in the field of software metrics, Maurice Halstead combined information science, psychology and his extensive experience to create a set of what he called Software Science Metrics. Unlike the McCabe complexity metrics, the Halstead metrics do not distinguish between conditional statements and straight-line statements. All the metrics are determined through mathematical relationships of four measures - distinct operators (n1), distinct operands (n2), total operators (N1) and total operands (N2). Program Vocabulary (n)