Measurement of Lines of Code-Metrics
with Testwell CMT++ and Testwell CMTJava
Testwell CMT++ and CMTJava are tools for analysing the code complexity of projects written in C, C++, Java and C#.
Lines of Code-Metrics are among the shown metrics.
Lines of Code-Metrics are among the shown metrics.
The lines of code measures are the most traditional measures used to quantify software complexity.
They are simple, easy to count, and very easy to understand.
They do not, however, take into account the intelligence content and the layout of the code.
Testwell CMT++ and CMTJava analyse for the following lines-of-code metrics:
Function length should be 4 to 40 program lines.
A function definition contains at least a prototype, one line of code, and a pair of braces, which makes 4 lines.
A function longer than 40 program lines probably implements many functions. Functions containing one selection statement with many branches are an exception to this rule. Decomposing them into smaller functions often decreases readability.
File length should be 4 to 400 program lines. The smallest entity that may reasonably occupy a whole source file is a function, and the minimum length of a function is 4 lines. Files longer than 400 program lines (10..40 functions) are usually too long to be understood as a whole.
At least 30 percent and at most 75 percent of a file should be comments.
If less than one third of a file is comments the file is either very trivial or poorly explained.
If more than 75% of a file are comments, the file is not a program but a document. In a well-documented header file percentage of comments may sometimes exceed 75%.
They are simple, easy to count, and very easy to understand.
They do not, however, take into account the intelligence content and the layout of the code.
Testwell CMT++ and CMTJava analyse for the following lines-of-code metrics:
- LOCphy: number of physical lines
- LOCbl: number of blank lines (a blank line inside a comment block is considered to be a comment line)
- LOCpro: number of program lines (declarations, definitions, directives, and code)
- LOCcom: number of comment lines
The following recommendations are given for the lines-of-code metrics:
Function length should be 4 to 40 program lines.
A function definition contains at least a prototype, one line of code, and a pair of braces, which makes 4 lines.
A function longer than 40 program lines probably implements many functions. Functions containing one selection statement with many branches are an exception to this rule. Decomposing them into smaller functions often decreases readability.
File length should be 4 to 400 program lines. The smallest entity that may reasonably occupy a whole source file is a function, and the minimum length of a function is 4 lines. Files longer than 400 program lines (10..40 functions) are usually too long to be understood as a whole.
At least 30 percent and at most 75 percent of a file should be comments.
If less than one third of a file is comments the file is either very trivial or poorly explained.
If more than 75% of a file are comments, the file is not a program but a document. In a well-documented header file percentage of comments may sometimes exceed 75%.
Testwell CMT++ and CMTJava show following software metrics:
Imagix 4D
Along with Testwell CMT++ and CMTJava, Verifysoft Technology offers Imagix 4D for measuring Software Complexity:We support you in order to choose the best tool for your purpose.
Contact us now!