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.
If you are interested to learn more about the process we followed, please refer to our paper.
Eman Abdullah AlOmar, Philip T. Rodriguez, Jordan Bowman, Tianjia Wang, Benjamin Adepoju, Kevin Lopez, Christian Newman, Ali Ouni, and Mohamed Wiem Mkaouer, "How Do Developers Refactor Code to Improve Code Reusability?", the International Conference on Software and Systems Reuse (ICSR'2020). [preprint]