The Inaccuracy of Uniform Counting in Software Metrics: Empirical Evidence with a Weighted Remedy
Listed in
This article is not in any list yet, why not save it to one of your lists.Abstract
Count-based metrics count the number of internal elements of a class, e.g., attributes, methods, and their interactions. Such metrics are used in a variety of areas of software engineering, e.g., measuring cohesion, detecting God Classes, and refactoring assistance. This paper criticizes the shortsightedness of the metrics and proves by statistical testing that the same treatment for all the number of class elements causes them to be measured with error. We introduce weighted and context-sensitive measures to overcome these limitations. A weighting system based on scientific literature and expert feedback is utilized within our method to emphasize the deficiencies of standard measures. Using Sahand 2.0, the fine-grained code analysis tool developed specifically to perform fine-grained code analysis, we executed three big Java open-source projects (RxJava, jmt, and Hibernate), and the result showed that our proposed weighting model detects bias over uniform couting. Even though our approach is promising, calculation of optimal weights remains problematic due to the subjective nature of expert-set weights and demands for further extensive validation. Our findings emphasize that more advanced methods, such as data-driven weight calculation or machine learning, are still needed to achieve more sustainable and trustworthy software systems.