Code Smells and Detection Techniques: A Survey: Conference Paper
Code Smells and Detection Techniques: A Survey: Conference Paper
Code Smells and Detection Techniques: A Survey: Conference Paper
net/publication/352274703
CITATIONS READS
0 293
3 authors, including:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Rana Menshawy on 29 June 2021.
Abstract— Design and code smells are characteristics in the There are many challenges to apply the proper refactoring,
software source code that might indicate a deeper design problem. such as how to detect a code smell, what is the refactoring
Code smells can lead to costly maintenance and quality problems, technique should be followed and the gain of applying it [2],
to remove these code smells, the software engineers should follow selecting a refactoring technique depends on the number of
the best practices, which are the set of correct techniques which removed smells, the number of modified elements and how
improve the software quality. Refactoring is an adequate the code will be maintained [6]. Applying a correct sequence
technique to fix code smells, software refactoring modifies the of refactoring techniques is very crucial because any wrong or
internal code structure without changing its functionality and incomplete refactoring can result in creating new smells and
suggests the best redesign changes to be performed. Developers
flaws in the code [7].
who apply correct refactoring sequences to remove code smells,
improve the software maintenance and development time Many developers are not aware of code smells [8], in
significantly. Many tools have been created to automatically or addition to that identification of smells requires training and
semi-automatically detect code smells and refactor them. This experience [9]. Automatic or semi-automatic detection and
study discusses the code smells, detection techniques, detection refactoring tools that support the identification of code smells
and refactoring tools, in addition to observing the challenges and and refactoring them, help the developers to save their effort
suggesting enhancements for better performance. and time. Most of the modern integrated development
environments (IDEs) such as Visual Studio and Eclipse
Keywords—Code smells, Software Refactoring, detection
techniques, Survey.
support software refactoring [10].
Previous survey studies discussed the challenges of code
I. INTRODUCTION smells by analyzing the code smells definitions, detection
Code smells refer to any sign that possibly can negatively techniques, detection and refactoring tools [2, 3, 9, 10, 11, 41].
affect the software process in a deeper way affecting the Some studies discussed the awareness of developers about
quality and maintainability of software [1]. Smells occurrence code smells, how the developers perceived code smells and
leads to a difficulty in modifying or understanding the code, the motivation for removing the smells [6, 8, 16, 42]. Other
implementing new features and fixing program issues become studies discussed the refactoring activities and limitations [5,
complex and time-consuming, making the software hard to 7, 12, 40], clone management and activities are discussed in
evolve and maintain. Adding new requirements will be a the study [15]. Some studies discussed the approaches and
difficult mission due to the code complexity and the design algorithms used in the detection and refactoring tools [43, 44,
flaws [2]. Smells are subjective in their definitions and 45, 46].
categorizations, besides that not all smells are considered This study intends to complement such previous
bugs, but they may affect the software design negatively in the investigations by discussing and identifying code smells,
future. detection approaches, detection and refactoring tools. The
The term “Refactoring” was introduced earlier by Opdyke paper is organized as follows: Section 2 describes the paper
and Fowler to remove code smells [1], software refactoring is methodology. Section 3 explores the code smells. Section 4
a well-known technique that is used by developers to remove discusses the detection approaches and algorithms and
code smells and consequently improve the design and the explored the most cited detection and refactoring tools.
evolution of any system. Refactoring aims to change the Section 5 explores our findings and concludes the paper.
internal code structure without changing the external behavior
improving the code flexibility and maintainability [3]. II. METHODOLOGY
Refactoring is done by applying a sequence of small In this section, the objective of this systematic literature
transformations preserving the same functionality [4]. review is discussed, and the criteria of the included relevant
Although software refactoring is a time-consuming process papers are identified.
that does not reflect immediate benefits like adding new
The search process is involved in Scopus digital library
features or fixing bugs, it allows any developer to read,
(https://www.scopus.com/), by applying a searching query:
maintain, understand and easily extend any software system
((“Code Smells” and “Refactoring” and “Survey”) or (“Code
[5].
Smells” and “detection techniques” and “Review”)) with date
range between 2006 and 2020. Scopus is chosen among other
databases such as Web of Science and Google Scholar [39].
This study is based on 19 previous studies, the objective is Switch Statements/ Object-Orientation [1, 2, 2, 11, 45]
to highlight the prior contributions in the code smells and the Repeated switches Abusers
refactoring fields, the purpose of this study literature review is Parallel Inheritance Object-Orientation [1, 2, 11, 45]
Hierarchies Abusers
to answer the following questions: Lazy Class [1, 2, 11, 45]
R1: What are the code smells discussed in the prior studies? Dispensables
R2: What are the detection approaches and algorithms? Speculative Generality [1, 2, 11, 45]
Dispensables
R3: What are the common tools used for code smell detection
and refactoring? Temporary Field Object-Orientation [1, 2, 11, 45]
Abusers
The criteria for inclusion include: Message Chains [1, 2, 11, 45]
• Papers describe the evaluation/ development/ usage Encapsulators
of detection techniques, detection, or refactoring Middle Man
Encapsulators
[1, 2, 11, 45]
tools.
Inappropriate Intimacy [1, 2, 11, 45]
• Only full papers are included. Couplers
• Papers that published in journals or conferences or Alternative Classes with Object-Orientation [1, 2, 11, 45]
workshops Different Interfaces Abusers
Incomplete Library [1, 2, 11, 45]
• Works published between 2006 and 2020 including Class
-
the recent papers. Refused Bequest Object-Orientation [1, 2, 11, 45, 46]
• Papers published with no author name are not Abusers
included. Comments [1, 2, 11, 45]
-
Cooperative-based [46] is a new technique that uses The most cited tools are presented in Table II with
different activities in order to improve the accuracy of the columns tool name, link, creation year, supported IDE, code
detection process. Applying different parallel algorithms such smells detected and the detection techniques. All the
as genetic algorithms, to reduce the search space and increase mentioned tools are used for detection only except JDeodorant
the search process speed. and TrueRefactor which are used for detection and
refactoring. Most of the mentioned tools support Java
Duplicated code is considered the most popular code smell language more than any other languages as clarified in in “Fig.
among all the smells [2, 5, 15], so researchers have 2”.
investigated clone management and created more detection
approaches for clone detection such as Token-Based, Syntax-
Based, Hash-Based and Graph-Based Comparisons [15]. SUPPORTED LANGUAGES
Detection approaches use different algorithms,
Java C C++ Python C# VB JavaScript Others
methodologies as:
• ML algorithms: create models from learning rules
with input data and cost functions. Some of these ML 7%
3%
solutions depend on random forests, decision trees, 3%
support vector machines, neural networks and deep
learning [43]. 7%