On Code Quality and Refactoring: Predicting Code Quality Decay and Recommending Meaningful Refactoring Actions

Decanato - Facoltà di scienze informatiche

Data: / -

Online

You are cordially invited to attend the PhD Dissertation Defence of Jevgenija Pantiuchina on Wednesday 7 July 2021 at 15:30 on MS Teams.

Abstract:
Code smells have been defined as symptoms of poor design and implementation choices. Empirical studies showed that code smells can have a negative impact on the understandability and maintainability of code. For this reason, tools have been developed in industry and academia to automatically detect design flaws and, in some cases, to recommend developers how to remove them via refactoring. However, these tools are not able to prevent the introduction of design flaws. This means that the code has to experience a quality decay (with a consequent increase of maintenance costs) before state-of-the-art tools can be applied to identify and refactor the design flaws. In addition, existing tools recommend refactoring operations that mostly target the improvement of some quality metrics (e.g., class cohesion) rather than the generation of refactorings that are meaningful from the developers’ perspective. Starting from these observations, we formulate our thesis statement: Predicting code components that are likely to be affected by code smells in the near future enables developers to take proper actions in the form of refactoring operations aimed at preventing quality degradation. While those refactorings could be recommended with the goal of optimizing code quality metrics, better recommendations might be possible by learning refactoring solutions from developers’ activities performed in open source projects. We investigate whether it is possible to predict code quality decay using machine learning classifiers by developing COSP2. COSP2 is able to predict classes in object oriented systems that are likely to be affected by code smells in the near future. It focuses on code smells characterized by excessive code size, complexity, and coupling. Then, with the goal of laying the empirical foundations to design better refactoring recommenders, we ran three empirical studies investigating (i) the reasons pushing developers to refactor source code, (ii) characteristics of refactoring contributions not appreciated by developers, and (iii) the ability of code quality metrics to assess changes in code quality as perceived by software developers. Finally, we performed an exploratory study aimed at investigating the ability of deep learning techniques to learn and replicate code transformations implemented by developers in open source projects. Our study shows the potential of using neural machine translation to build refactoring recommenders able to learn from developers’ activities how to suggest meaningful refactoring recommendations.

Dissertation Committee:
- Prof. Gabriele Bavota, Università della Svizzera italiana, Switzerland (Research Advisor)
- Prof. Matthias Hauswirth, Università della Svizzera italiana, Switzerland (Internal Member)
- Prof. Paolo Tonella, Università della Svizzera italiana, Switzerland (Internal Member)
- Prof. Vittorio Cortellessa, Università degli Studi dell'Aquila, Italy (External Member)
- Prof. Mario Linares Vásquez, Universidad de los Andes, Colombia (External Member)

Facoltà