80 research outputs found
A Mono- and Multi-objective Approach for Recommending Software Refactoring
Les systèmes logiciels sont devenus de plus en plus répondus et importants dans notre société. Ainsi, il y a un besoin constant de logiciels de haute qualité. Pour améliorer la qualité de logiciels, l’une des techniques les plus utilisées est le refactoring qui sert à améliorer la structure d'un programme tout en préservant son comportement externe. Le refactoring promet, s'il est appliqué convenablement, à améliorer la compréhensibilité, la maintenabilité et l'extensibilité du logiciel tout en améliorant la productivité des programmeurs. En général, le refactoring pourra s’appliquer au niveau de spécification, conception ou code. Cette thèse porte sur l'automatisation de processus de recommandation de refactoring, au niveau code, s’appliquant en deux étapes principales: 1) la détection des fragments de code qui devraient être améliorés (e.g., les défauts de conception), et 2) l'identification des solutions de refactoring à appliquer.
Pour la première étape, nous traduisons des régularités qui peuvent être trouvés dans des exemples de défauts de conception. Nous utilisons un algorithme génétique pour générer automatiquement des règles de détection à partir des exemples de défauts.
Pour la deuxième étape, nous introduisons une approche se basant sur une recherche heuristique. Le processus consiste à trouver la séquence optimale d'opérations de refactoring permettant d'améliorer la qualité du logiciel en minimisant le nombre de défauts tout en priorisant les instances les plus critiques. De plus, nous explorons d'autres objectifs à optimiser: le nombre de changements requis pour appliquer la solution de refactoring, la préservation de la sémantique, et la consistance avec l’historique de changements. Ainsi, réduire le nombre de changements permets de garder autant que possible avec la conception initiale. La préservation de la sémantique assure que le programme restructuré est sémantiquement cohérent. De plus, nous utilisons l'historique de changement pour suggérer de nouveaux refactorings dans des contextes similaires.
En outre, nous introduisons une approche multi-objective pour améliorer les attributs de qualité du logiciel (la flexibilité, la maintenabilité, etc.), fixer les « mauvaises » pratiques de conception (défauts de conception), tout en introduisant les « bonnes » pratiques de conception (patrons de conception).Software systems have become prevalent and important in our society. There is a constant need for high-quality software. Hence, to improve software quality, one of the most-used techniques is the refactoring which improves design structure while preserving the external behavior. Refactoring has promised, if applied well, to improve software readability, maintainability and extendibility while increasing the speed at which programmers can write and maintain their code. In general, refactoring can be performed in various levels such as the requirement, design, or code level. In this thesis, we mainly focus on the source code level where automated refactoring recommendation can be performed through two main steps: 1) detection of code fragments that need to be improved/fixed (e.g., code-smells), and 2) identification of refactoring solutions to achieve this goal.
For the code-smells identification step, we translate regularities that can be found in such code-smell examples into detection rules. To this end, we use genetic programming to automatically generate detection rules from examples of code-smells.
For the refactoring identification step, a search-based approach is used. The process aims at finding the optimal sequence of refactoring operations that improve software quality by minimizing the number of detected code-smells while prioritizing the most critical ones. In addition, we explore other objectives to optimize using a multi-objective approach: the code changes needed to apply refactorings, semantics preservation, and the consistency with development change history. Hence, reducing code changes allows us to keep as much as possible the initial design. On the other hand, semantics preservation insures that the refactored program is semantically coherent, and that it models correctly the domain-semantics. Indeed, we use knowledge from historical code change to suggest new refactorings in similar contexts.
Furthermore, we introduce a novel multi-objective approach to improve software quality attributes (i.e., flexibility, maintainability, etc.), fix “bad” design practices (i.e., code-smells) while promoting “good” design practices (i.e., design patterns)
Mining and Managing Big Data Refactoring for Design Improvement: Are We There Yet?
Refactoring is a set of code changes applied to improve the internal structure of a program, without altering its external behavior. With the rise of continuous integration and the awareness of the necessity of managing technical debt, refactoring has become even more popular in recent software builds. Recent studies indicate that developers often perform refactorings. If we consider all refactorings performed across all projects, this consists of the refactoring knowledge that represents a rich source of information that can be useful for both developers and practitioners to better understand how refactoring is being applied in practice. However, mining, processing, and extracting useful insights, from this plethora of refactorings, seems to be challenging. In this book chapter, we take a dive into how refactoring can be mined and preprocessed. We discuss all design concepts and structural metrics that can also be mined along with refactoring operations to understand their impact better. We further investigate the many practical challenges for such extraction. The volume, velocity, and variety of extracted data require careful planning. We outline the appropriate techniques from a large number of available technologies for such system implementation
Toward the Automatic Classification of Self-Affirmed Refactoring
The concept of Self-Affirmed Refactoring (SAR) was introduced to explore how developers document their refactoring activities in commit messages, i.e., developers explicit documentation of refactoring operations intentionally introduced during a code change. In our previous study, we have manually identified refactoring patterns and defined three main common quality improvement categories including internal quality attributes, external quality attributes, and code smells, by only considering refactoring-related commits. However, this approach heavily depends on the manual inspection of commit messages. In this paper, we propose a two-step approach to first identify whether a commit describes developer-related refactoring events, then to classify it according to the refactoring common quality improvement categories. Specifically, we combine the N-Gram TF-IDF feature selection with binary and multiclass classifiers to build a new model to automate the classification of refactorings based on their quality improvement categories. We challenge our model using a total of 2,867 commit messages extracted from well engineered open-source Java projects. Our findings show that (1) our model is able to accurately classify SAR commits, outperforming the pattern-based and random classifier approaches, and allowing the discovery of 40 more relevent SAR patterns, and (2) our model reaches an F-measure of up to 90% even with a relatively small training datase
Can Refactoring be Self-Affirmed? An Exploratory Study on How Developers Document their Refactoring Activities in Commit Messages
Refactoring is a critical task in software maintenance and is usually performed to enforce best design practices, or to cope with design defects. Previous studies heavily rely on defining a set of keywords to identify refactoring commits from a list of general commits extracted from a small set of softwaresystems. All approaches thus far consider all commits without checking whether refactorings had actually happened or not. In this paper, we aim at exploring how developers document their refactoring activities during the software life cycle. We call such activity Self-Affirmed Refactoring, which is an indication ofthe developer-related refactoring events in the commit messages. Our approach relies on text mining refactoring-related change messages and identifying refactoring patterns by only consideringrefactoring commits. We found that (1) developers use a variety of patterns to purposefully target refactoring-related activities; (2) developers tend to explicitly mention the improvement of specific quality attributes and code smells; and (3) commit messages withself-affirmed refactoring patterns tend to have more significant refactoring activit
Behind the Intent of Extract Method Refactoring: A Systematic Literature Review
Code refactoring is widely recognized as an essential software engineering
practice to improve the understandability and maintainability of the source
code. The Extract Method refactoring is considered as "Swiss army knife" of
refactorings, as developers often apply it to improve their code quality. In
recent years, several studies attempted to recommend Extract Method
refactorings allowing the collection, analysis, and revelation of actionable
data-driven insights about refactoring practices within software projects. In
this paper, we aim at reviewing the current body of knowledge on existing
Extract Method refactoring research and explore their limitations and potential
improvement opportunities for future research efforts. Hence, researchers and
practitioners begin to be aware of the state-of-the-art and identify new
research opportunities in this context. We review the body of knowledge related
to Extract Method refactoring in the form of a systematic literature review
(SLR). After compiling an initial pool of 1,367 papers, we conducted a
systematic selection and our final pool included 83 primary studies. We define
three sets of research questions and systematically develop and refine a
classification schema based on several criteria including their methodology,
applicability, and degree of automation. The results construct a catalog of 83
Extract Method approaches indicating that several techniques have been proposed
in the literature. Our results show that: (i) 38.6% of Extract Method
refactoring studies primarily focus on addressing code clones; (ii) Several of
the Extract Method tools incorporate the developer's involvement in the
decision-making process when applying the method extraction, and (iii) the
existing benchmarks are heterogeneous and do not contain the same type of
information, making standardizing them for the purpose of benchmarking
difficult
Automating Source Code Refactoring in the Classroom
Refactoring is the practice of improving software quality without altering
its external behavior. Developers intuitively refactor their code for multiple
purposes, such as improving program comprehension, reducing code complexity,
dealing with technical debt, and removing code smells. However, no prior
studies have exposed the students to an experience of the process of
antipatterns detection and refactoring correction, and provided students with
toolset to practice it. To understand and increase the awareness of refactoring
concepts, in this paper, we aim to reflect on our experience with teaching
refactoring and how it helps students become more aware of bad programming
practices and the importance of correcting them via refactoring. This paper
discusses the results of an experiment in the classroom that involved carrying
out various refactoring activities for the purpose of removing antipatterns
using JDeodorant, an Eclipse plugin that supports antipatterns detection and
refactoring. The results of the quantitative and qualitative analysis with 171
students show that students tend to appreciate the idea of learning refactoring
and are satisfied with various aspects of the JDeodorant plugin's operation.
Through this experiment, refactoring can turn into a vital part of the
computing educational plan. We envision our findings enabling educators to
support students with refactoring tools tuned towards safer and trustworthy
refactoring
Code Review Practices for Refactoring Changes: An Empirical Study on OpenStack
Modern code review is a widely used technique employed in both industrial and open-source projects to improve software quality, share knowledge, and ensure adherence to coding standards and guidelines. During code review, developers may discuss refactoring activities before merging code changes in the code base. To date, code review has been extensively studied to explore its general challenges, best practices and outcomes, and socio-technical aspects. However, little is known about how refactoring is being reviewed and what developers care about when they review refactored code. Hence, in this work, we present a quantitative and qualitative study to understand what are the main criteria developers rely on to develop a decision about accepting or rejecting a submitted refactored code, and what makes this process challenging. Through a case study of 11,010 refactoring and non-refactoring reviews spread across OpenStack open-source projects, we find that refactoring-related code reviews take significantly longer to be resolved in terms of code review efforts. Moreover, upon performing a thematic analysis on a significant sample of the refactoring code review discussions, we built a comprehensive taxonomy consisting of 28 refactoring review criteria. We envision our findings reaffirming the necessity of developing accurate and efficient tools and techniques that can assist developers in the review process in the presence of refactorings
On Preserving the Behavior in Software Refactoring: A Systematic Mapping Study
Context: Refactoring is the art of modifying the design of a system without
altering its behavior. The idea is to reorganize variables, classes and methods
to facilitate their future adaptations and comprehension. As the concept of
behavior preservation is fundamental for refactoring, several studies, using
formal verification, language transformation and dynamic analysis, have been
proposed to monitor the execution of refactoring operations and their impact on
the program semantics. However, there is no existing study that examines the
available behavior preservation strategies for each refactoring operation.
Objective: This paper identifies behavior preservation approaches in the
research literature.
Method: We conduct, in this paper, a systematic mapping study, to capture all
existing behavior preservation approaches that we classify based on several
criteria including their methodology, applicability, and their degree of
automation.
Results: The results indicate that several behavior preservation approaches
have been proposed in the literature. The approaches vary between using
formalisms and techniques, developing automatic refactoring safety tools, and
performing a manual analysis of the source code.
Conclusion: Our taxonomy reveals that there exist some types of refactoring
operations whose behavior preservation is under-researched. Our classification
also indicates that several possible strategies can be combined to better
detect any violation of the program semantics
- …