Back to overview

Improving Code: The (Mis)perception of Quality Metrics

Type of publication Peer-reviewed
Publikationsform Proceedings (peer-reviewed)
Author Pantiuchina Jevgenija, Lanza Michele, Bavota Gabriele,
Project PROBE - Live Actionable Software Analytics
Show all

Proceedings (peer-reviewed)

Page(s) 80 - 91
Title of proceedings Proceedings of ICSME 2018 (34th International Conference on Software Maintenance and Evolution)

Open Access

Type of Open Access Repository (Green Open Access)


Code quality metrics are widely used to identify design flaws (e.g., code smells) as well as to act as fitness functions for refactoring recommenders. Both these applications imply a strong assumption: quality metrics are able to assess code quality as perceived by developers. Indeed, code smell detectors and refactoring recommenders should be able to identify design flaws/recommend refactorings that are meaningful from the developer’s point-of-view. While such an assumption might look reasonable, there is limited empirical evidence supporting it. We aim at bridging this gap by empirically investigating whether quality metrics are able to capture code quality im- provement as perceived by developers. While previous studies surveyed developers to investigate whether metrics align with their perception of code quality, we mine commits in which developers clearly state in the commit message their aim of improving one of four quality attributes: cohesion, coupling, code readability, and code complexity. Then, we use state-of-the-art metrics to assess the change brought by each of those commits to the specific quality attribute it targets. We found that, more often than not the considered quality metrics were not able to capture the quality improvement as perceived by developers (e.g., the developer states “improved the cohesion of class C”, but no quality metric captures such an improvement).