Software Metrics

Michael L. Collard, Ph.D.

Department of Computer Science, The University of Akron


  • Which approach/design is better?
  • What are the problem areas in our system?
  • Do we "clean up" (refactoring) or implement new features?
  • What should the budget be for refactoring?

Why Measure?

  • Determine the quality of a product or process
  • Predict the qualities of a product or process
  • Improve the quality of a product or process

  • Must be able to compare these measurements to others

Example: LOC

Lines of code

  • Equate effort to the LOC required
  • More LOC -> More effort, Less LOC -> Less effort
  • Easy to compute on existing projects

Definition: measure

Quantitative indication of extent, amount, dimension, capacity, or size of some attribute of a product or process

  • E.g., LOC

Definition: metric

Quantitative measure of the degree to which a system, component or process possesses a given attribute. "A handle or guess about a given attribute."

  • E.g., LOC per developer day

Using LOC

  • Assume know LOC/day (developer)
  • Estimate new project LOC
  • Have an estimate on the number of developer days

More on LOC

  • KLOC - 1,000 LOC
  • MLOC - 1,000 KLOC
  • Can relate any part of the system to LOC
  • Errors/KLOC
  • Defects/KLOC
  • Cost/KLOC
  • LOC is Language Dependent
  • LOC can be misleading (Discuss)

Direct Measures

  • LOC
  • Cost
  • Effort - person days
  • Speed
  • Memory

Indirect Measures

  • Functionality
  • Quality
  • Complexity
  • Efficiency
  • Reliability
  • Maintainability

Function-Oriented Metrics

  • Function-Point Analysis [Albrecht'79,'83]
  • Count parts of the system
  • International Function Point Users Group (IFPUG)
  • Can be performed on requirements

Function Points

  • User Inputs - distinct input from the user
  • User Outputs - reports, screens, error messages, etc.
  • User Inquires - input that generates a result, e.g., search
  • Files - datafile, database tables
  • External Interfaces - interfaces to other systems
  • etc.

Complexity Adjustments

  • Data communications?
  • Distributed processing?
  • Performance critical?
  • Heavily-used configuration?
  • Online data entry?
  • End-user efficiency?
  • Online update?
  • Complex processing?
  • Reusability?
  • Installation ease?
  • Operational ease?
  • Multiple sites?
  • Facilitate change?

Function Point and Language

Using Direct Metrics

Function Point and LOC-based metrics have been found to be relatively accurate predictors of effort and cost

  • Need a historical baseline to use them properly
  • Language dependent
  • LOC can be easily reverse-engineered from existing systems (wc -l)
  • Function Points cannot be easily reverse-engineered from existing systems

Metric Values

  • Difficult to know if a particular metric value is okay or not
  • However, we can more easily determine the following:
  • What metric values are bad or good
  • What direction the metric value is moving towards

Example: LOC/File

  • Range: 0 to ∞
  • Assume current is 1KLOC/file
  • New measure: 800 LOC/file
  • Judgement (Discuss)
  • New measure: 1.2 KLOC/file
  • Judgement (Discuss)