Wei Lu and Min-Yen Kan
AIRS 2005 (Jeju Island, Korea)
11/22
Code Metrics Analysis
•Metrics: measurement of program source code
–Complexity: statistical measurements, e.g. CC, IFIN
– We proposed our own metrics in addition to published metrics
Example:
a(2);
function a(x){
  if(x>1){
     z=1:2?(y>1);
  }
}
TCC=2+1=3
(total cyclomatic complexity of the code)
IFIN=1+1+2=4
(degree of information flows)
– Reuse: code similarity via some form of edit distance
– SED: String-based Edit Distance
– TED: Tree (Abstract Syntax Tree)-based Edit Distance
– LED: Lexical, token-based Edit Distance
Software metrics are frequently used in software maintenance tasks. Metrics are measurements of program source codes.
In this paper we examined two types of metrics.
Complexity metrics are actually statistical measurements of certain code properties. There are many well-known classic complexity metrics such as CC and IFIN
For example, CC is a complexity metric which measures the total cyclomatic complexity of the code. It is the total number of conditional statements plus 1. Therefore in the left example, this metric is 3.
Reuse metrics are measurements of similarities amongst codes. The similarities are typically measured using an edit distance approach. We have examined three approaches here, string-based edit distance, tree-based edit distance, as well as a token-based edit distance approach.