Mining Task-Specific Lines of Code Counters

Context: Lines of code (LOC) is a fundamental software code measure that is widely used as a proxy for software development effort or as a normalization factor in many other software-related measures (e.g., defect density). Unfortunately, the problem is that it is not clear which lines of code shoul...

Full description

Bibliographic Details
Main Authors: Miroslaw Ochodek, Krzysztof Durczak, Jerzy Nawrocki, Miroslaw Staron
Format: Article
Language:English
Published: IEEE 2023-01-01
Series:IEEE Access
Subjects:
Online Access:https://ieeexplore.ieee.org/document/10247541/
_version_ 1797680897206517760
author Miroslaw Ochodek
Krzysztof Durczak
Jerzy Nawrocki
Miroslaw Staron
author_facet Miroslaw Ochodek
Krzysztof Durczak
Jerzy Nawrocki
Miroslaw Staron
author_sort Miroslaw Ochodek
collection DOAJ
description Context: Lines of code (LOC) is a fundamental software code measure that is widely used as a proxy for software development effort or as a normalization factor in many other software-related measures (e.g., defect density). Unfortunately, the problem is that it is not clear which lines of code should be counted: all of them or some specific ones depending on the project context and task in mind? Objective: To design a generator of task-specific LOC measures and their counters mined directly from data that optimize the correlation between the LOC measures and variables they proxy for (e.g., code-review duration). Method: We use Design Science Research as our research methodology to build and validate a generator of task-specific LOC measures and their counters. The generated LOC counters have a form of binary decision trees inferred from historical data using Genetic Programming. The proposed tool was validated based on three tasks, i.e., mining LOC measures to proxy for code readability, number of assertions in unit tests, and code-review duration. Results: Task-specific LOC measures showed a &#x201C;strong&#x201D; to &#x201C;very strong&#x201D; negative correlation with code-readability score (Kendall&#x2019;s <inline-formula> <tex-math notation="LaTeX">$\tau $ </tex-math></inline-formula> ranging from &#x2212;0.83 to &#x2212;0.76) compared to &#x201C;weak&#x201D; to &#x201C;strong&#x201D; negative correlation for the best among the standard LOC measures (<inline-formula> <tex-math notation="LaTeX">$\tau $ </tex-math></inline-formula> ranging from &#x2212;0.36 to &#x2212;0.13). For the problem of proxying for the number of assertions in unit tests, correlation coefficients were also higher for task-specific LOC measures by ca. 11&#x0025; to 21&#x0025; (<inline-formula> <tex-math notation="LaTeX">$\tau $ </tex-math></inline-formula> ranged from 0.31 to 0.34). Finally, task-specific LOC measures showed a stronger correlation with code-review duration than the best among the standard LOC measures (<inline-formula> <tex-math notation="LaTeX">$\tau $ </tex-math></inline-formula> &#x003D; 0.31, 0.36, and 0.37 compared to 0.11, 0.08, 0.16, respectively). Conclusions: Our study shows that it is possible to mine task-specific LOC counters from historical datasets using Genetic Programming. Task-specific LOC measures obtained that way show stronger correlations with the variables they proxy for than the standard LOC measures.
first_indexed 2024-03-11T23:36:00Z
format Article
id doaj.art-75aabb40cee245bdb6f1324f90b6dbce
institution Directory Open Access Journal
issn 2169-3536
language English
last_indexed 2024-03-11T23:36:00Z
publishDate 2023-01-01
publisher IEEE
record_format Article
series IEEE Access
spelling doaj.art-75aabb40cee245bdb6f1324f90b6dbce2023-09-19T23:02:10ZengIEEEIEEE Access2169-35362023-01-011110021810023310.1109/ACCESS.2023.331457210247541Mining Task-Specific Lines of Code CountersMiroslaw Ochodek0https://orcid.org/0000-0002-9103-717XKrzysztof Durczak1Jerzy Nawrocki2https://orcid.org/0000-0003-2724-0103Miroslaw Staron3https://orcid.org/0000-0002-9052-0864Faculty of Computing and Telecommunications, Poznan University of Technology, Poznan, PolandFaculty of Computing and Telecommunications, Poznan University of Technology, Poznan, PolandFaculty of Computing and Telecommunications, Poznan University of Technology, Poznan, PolandDepartment of Computer Science and Engineering, University of Gothenburg | Chalmers, Gothenburg, SwedenContext: Lines of code (LOC) is a fundamental software code measure that is widely used as a proxy for software development effort or as a normalization factor in many other software-related measures (e.g., defect density). Unfortunately, the problem is that it is not clear which lines of code should be counted: all of them or some specific ones depending on the project context and task in mind? Objective: To design a generator of task-specific LOC measures and their counters mined directly from data that optimize the correlation between the LOC measures and variables they proxy for (e.g., code-review duration). Method: We use Design Science Research as our research methodology to build and validate a generator of task-specific LOC measures and their counters. The generated LOC counters have a form of binary decision trees inferred from historical data using Genetic Programming. The proposed tool was validated based on three tasks, i.e., mining LOC measures to proxy for code readability, number of assertions in unit tests, and code-review duration. Results: Task-specific LOC measures showed a &#x201C;strong&#x201D; to &#x201C;very strong&#x201D; negative correlation with code-readability score (Kendall&#x2019;s <inline-formula> <tex-math notation="LaTeX">$\tau $ </tex-math></inline-formula> ranging from &#x2212;0.83 to &#x2212;0.76) compared to &#x201C;weak&#x201D; to &#x201C;strong&#x201D; negative correlation for the best among the standard LOC measures (<inline-formula> <tex-math notation="LaTeX">$\tau $ </tex-math></inline-formula> ranging from &#x2212;0.36 to &#x2212;0.13). For the problem of proxying for the number of assertions in unit tests, correlation coefficients were also higher for task-specific LOC measures by ca. 11&#x0025; to 21&#x0025; (<inline-formula> <tex-math notation="LaTeX">$\tau $ </tex-math></inline-formula> ranged from 0.31 to 0.34). Finally, task-specific LOC measures showed a stronger correlation with code-review duration than the best among the standard LOC measures (<inline-formula> <tex-math notation="LaTeX">$\tau $ </tex-math></inline-formula> &#x003D; 0.31, 0.36, and 0.37 compared to 0.11, 0.08, 0.16, respectively). Conclusions: Our study shows that it is possible to mine task-specific LOC counters from historical datasets using Genetic Programming. Task-specific LOC measures obtained that way show stronger correlations with the variables they proxy for than the standard LOC measures.https://ieeexplore.ieee.org/document/10247541/Software measurementsoftware sizelines of codeLOC
spellingShingle Miroslaw Ochodek
Krzysztof Durczak
Jerzy Nawrocki
Miroslaw Staron
Mining Task-Specific Lines of Code Counters
IEEE Access
Software measurement
software size
lines of code
LOC
title Mining Task-Specific Lines of Code Counters
title_full Mining Task-Specific Lines of Code Counters
title_fullStr Mining Task-Specific Lines of Code Counters
title_full_unstemmed Mining Task-Specific Lines of Code Counters
title_short Mining Task-Specific Lines of Code Counters
title_sort mining task specific lines of code counters
topic Software measurement
software size
lines of code
LOC
url https://ieeexplore.ieee.org/document/10247541/
work_keys_str_mv AT miroslawochodek miningtaskspecificlinesofcodecounters
AT krzysztofdurczak miningtaskspecificlinesofcodecounters
AT jerzynawrocki miningtaskspecificlinesofcodecounters
AT miroslawstaron miningtaskspecificlinesofcodecounters