JITRA - Just-In-Time Rational refActoring
In the software life-cycle, change is the rule rather than the exception. A key point for sustainable program evolution is to tackle software complexity, making sure that the source code exhibits a high quality thus easing maintenance and evolution activities. Indeed, several empirical studies have provided evidence that low code quality is generally associated with lower productivity, more rework, and more effort for developers. While there is agreement on the need for good software quality, modern IDEs (Integrated Development Environments) only provide basic support to developers for fighting low quality code. Thus, tools have been developed in industry and academia to automatically detect design flaws and, in some cases, to recommend to 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/evolution costs) before state-of-the-art tools can be applied to identify and refactor the design flaws. In addition, existing tools recommend refactoring operations without providing the developer with a "rationale" motivating the need for the recommended refactoring. Our goal is to develop models and techniques serving as the basis for a new generation of intelligent recommendation systems aimed at (i) preventing, via refactoring operations, the introduction of design flaws rather than fixing them once they already affect the system, and (ii) explaining the rationale behind the recommended refactorings. We refer to such a novel perspective on software refactoring as just-in-time rational refactoring. The JITRA project aims at answering the following research questions: Q1 What are the distinctive characteristics of high- and low-quality code? How can we predict which code components are likely to represent a maintainability issue in the near future?Q2 How can we learn from the past the best refactoring strategies to apply in a given context and the rationale behind them? Q3 How can we develop smart recommenders supporting just-in-time refactoring? Can such recommenders provide, besides the recommended refactorings, the rationale behind such recommendations? For the JITRA project we propose to investigate the following research tracks: Modelling Code Quality and Predicting its Decay. The goal is to develop models describing code quality and the typical chain of events leading to its decay. The models will be used to predict code components that are likely to represent a maintainability issue in the near future. Modelling Refactoring Strategies and their Rationale. The goal is to build a large dataset of refactoring strategies applied by developers over the change history of software systems to improve the quality of their code. By mining structured and unstructured data we will model refactoring strategies (what has been changed in the code) together with their rationale (why such changes have been applied).Learning From the Past and Recommend for the Future. We want to exploit the large datasets built in the second track to design and develop a refactoring engine able to learn from the past the best refactoring operations to apply in a given context to avoid code quality decay. The recommended refactorings will be accompanied by a natural language explanation justifying their need. Prototyping & Validation. The code quality prediction models and the refactoring engine developed in the first and in the third tracks will be integrated to periodically release prototypes of a recommender system implementing our vision of just-in-time refactoring. The prototypes will be evaluated through controlled experiments and case studies.