Density of Comments (DC)

Density of Comments (DC) provides the ratio of comment lines (CLOC) to all lines (LOC). Hence, DC = CLOC / LOC. The density of comments value will be between 0.0 and 1.0 and it can be used as a quality indicator to see how much of the code is commented. So if the comment density for instance is below a certain value defined by the project manager, it indicates that the code is under commented. RefactorIT recommends a commenting of at least 20% of the code and a maximum of 40%. Thus, the lower limit for density of comments is 0.2 and the upper recommended value is 0.4. Confer with CLOC and LOC to see how RefactorIT evaluates these values.