SANER 2017

2017 IEEE 24th International Conference on Software Analysis, Evolution, and Reengineering (SANER), February 20-24, 2017, Klagenfurt, Austria

Desktop Layout

Code Smells and Refactoring
Main Research
An Empirical Study of Code Smells in JavaScript Projects
Amir Saboury, Pooya Musavi, Foutse Khomh, and Giuliano Antoniol
(Polytechnique Montréal, Canada)
Abstract: JavaScript is a powerful scripting programming language that has gained a lot of attention this past decade. Initially used exclusively for client-side web development, it has evolved to become one of the most popular programming languages, with developers now using it for both client-side and server-side application development. Similar to applications written in other programming languages, JavaScript applications contain emph{code smells}, which are emph{poor} design choices that can negatively impact the quality of an application. In this paper, we investigate code smells in JavaScript server-side applications with the aim to understand how they impact the fault-proneness of applications. We detect 12 types of code smells in 537 releases of five popular JavaScript applications (textit{i.e.,} express, grunt, bower, less.js, and request) and perform survival analysis, comparing the time until a fault occurrence, in files containing code smells and files without code smells. Results show that (1) on average, files without code smells have hazard rates 65% lower than files with code smells. (2) Among the studied smells, ``Variable Re-assign" and ``Assignment In Conditional statements" code smells have the highest hazard rates. Additionally, we conduct a survey with 1,484 JavaScript developers, to understand the perception of developers towards our studied code smells. We found that developers consider ``Nested Callbacks", ``Variable Re-assign" and ``Long Parameter List" code smells to be serious design problems that hinder the maintainability and reliability of applications. This assessment is in line with the findings of our quantitative analysis. Overall, code smells affect negatively the quality of JavaScript applications and developers should consider tracking and removing them early on before the release of applications to the public.

Authors:


Time stamp: 2020-02-28T21:59:32+01:00