Robert Smyth's BlogCode Metrics
|
My real home (Turrif) | |||||||||||||||
|
Contents
Lines Of Code (LOC)Lines of code (LOC) is a count of each line that has any code element. It is easy to measure but almost impossible to interpret as is highly dependent on coding standard, language, environment, and coders skill (good coders may do the same with fewer lines). For example, the table below shows the same code written with different coding standards. The difference is 70%.
A better measure of effort may be effective lines of code (eLOC). For a more detailed discussion of LOC go to http://c2.com/cgi/wiki?LinesOfCode. Effective Lines Of Code (eLOC)Effective lines of code (eLOC) is a count of code statements. It provides a better measurement of effort than lines of code (LOC) and is a complexity indicator. For example the following code has a 4 effective lines of code.
See also: Cyclomatic Complexity (Vg)Cyclomatic complexity (Vg) is a calculation of function/method complexity.
Cyclomatic complexity is a count of the number of basic decisions in a function by assigning 1 point to each of the following:
For example the following function has a Vg of 4. Each point is shown in bold.
For more information on cyclomatic complexity go to http://www.sei.cmu.edu/str/descriptions/cyclomatic_body.html. Kiviat ChartsA kiviat chart visual displays a set of metrics that provides easy viewing of multiple metrics against minimum and maximum thresholds. Each radial of chart is a metric. All metrics are scaled so that all maximums are on a common circle and all minimums are on a common circle. In the charts below the red circle is the maximum threshold and the blue band is the minimum threshold. The white band between the two is the acceptable range. The chart on the left shows that all metrics are well within the acceptable range. The chart on the right shows an example where all metrics are above maximum limits.
Other Code Metrics Tools & InformationBelow is a list of other code metrics tools available on sourceforge. Others (not sourceforge):
|
|
||||||||||||||
|
Last updated 18th July, 2004, Email: robsmyth at bigpond.net.au
|
||||||||||||||||