Development nature matters: An empirical study of code clones in JavaScript applications

被引:0
作者
Wai Ting Cheung
Sukyoung Ryu
Sunghun Kim
机构
[1] KAIST,Department of Computer Science
[2] The Hong Kong University of Science and Technology,Department of Computer Science and Engineering
来源
Empirical Software Engineering | 2016年 / 21卷
关键词
JavaScript; Code clones; Web applications; Clone properties; Software metrics; Cloning patterns;
D O I
暂无
中图分类号
学科分类号
摘要
Code cloning is one of the active research areas in the software engineering community. Specifically, researchers have conducted numerous empirical studies on code cloning and reported that 7 % to 23 % of the code in a typical software system has been cloned. However, there was less awareness of code clones in dynamically-typed languages and most studies are limited to statically-typed languages such as Java, C, and C++. In addition, most previous studies did not consider different application domains such as standalone projects or web applications. As a result, very little is known about clones in dynamically-typed languages, such as JavaScript, in different application domains. In this paper, we report a large-scale clone detection experiment in a dynamically-typed programming language, JavaScript, for different application domains: web pages and standalone projects. Our experimental results showed that unlike JavaScript standalone projects, JavaScript web applications have 95 % of inter-file clones and 91–97 % of widely scattered clones. We observed that web application developers created clones intentionally and such clones may not be as risky as claimed in previous studies. Understanding the risks of cloning in web applications requires further studies, as cloning may be due to either good or bad intentions. Also, we identified unique development practices such as including browser-dependent or device-specific code in code clones of JavaScript web applications. This indicates that features of programming languages and technologies affect how developers duplicate code.
引用
收藏
页码:517 / 564
页数:47
相关论文
共 61 条
[41]  
Notkin D(undefined)undefined undefined undefined undefined-undefined
[42]  
Murphy G(undefined)undefined undefined undefined undefined-undefined
[43]  
Kontogiannis K(undefined)undefined undefined undefined undefined-undefined
[44]  
DeMori R(undefined)undefined undefined undefined undefined-undefined
[45]  
Merlo E(undefined)undefined undefined undefined undefined-undefined
[46]  
Galler M(undefined)undefined undefined undefined undefined-undefined
[47]  
Bernstein M(undefined)undefined undefined undefined undefined-undefined
[48]  
Kou G(undefined)undefined undefined undefined undefined-undefined
[49]  
Lou C(undefined)undefined undefined undefined undefined-undefined
[50]  
Rahman F(undefined)undefined undefined undefined undefined-undefined