In this empirical study, we aim at identifying, among the various quality models presented in the literature, the ones that are more in-line with the developer's vision of reusability optimization, when they explicitly mention that they are refactoring to improve them. We extract a large corpus of design-related refactoring activities that are applied and documented by developers during their daily changes from 1,828 curated open source Java projects. In particular, we extract structural metrics from which we identify 1,967 reusability improvement commits with their corresponding refactoring operations, as perceived by software engineers. Thereafter, we empirically analyze the impact of these refactoring operations on a set of common state-of-the-art design quality metrics.
More specifically, the research questions that we investigated are:
RQ1. Do developers refactor code differently for the purpose of improving reusability?
To answer this research question, we extract the type of refactorings that are chosen by developers to improve reusability. We also investigate if there are any refactoring patterns that are specific to reusability, by comparing the distribution of reusability-related refactorings, with the distribution of refactorings for other mainstream development tasks. Then, we identify any significant differences between the distribution values in the two populations.
RQ2. What is the impact of reusability refactorings on structural metrics?
To answer this research question, we consider the state-of-the-art reusability structural metrics, extracted from previous studies. We calculate these metrics on fles before and after they were refactored for improving reusability. Then we analyze the impact of refactorings on the variation of these metrics, to see if they were capturing the improvement.
RQ3. What triggers developers to refactor the code for the purpose of code reuse?
To answer this research question, we perform case studies that demonstrate GitHub developers’ intentions when refactoring source code to improve code reusability.
If you are interested to learn more about the process we followed, please refer to our paper.
Eman Abdullah AlOmar, Tianjia Wang, Vaibhavi Raut, Mohamed Wiem Mkaouer, Christian Newman, and Ali Ouni, "Refactoring for Reuse: An Empirical Study", the Innovations in Systems and Software Engineering (ISSE'2021). [preprint]