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 条
[1]  
Antoniol G(2002)Analyzing cloning evolution in the Linux kernel Inf Softw Technol 44 755-765
[2]  
Villano U(2007)Comparison and evaluation of clone detection tools IEEE Trans Softw Eng 33 577-591
[3]  
Merlo E(2012)An empirical study on inconsistent changes to code clones at the release level Sci Comput Program 77 760-776
[4]  
Di Penta M(2004)Function clone detection in web applications: a semiautomated approach J Web Eng 3 3-21
[5]  
Bellon S(1994)A metrics suite for object oriented design IEEE Trans Softw Eng 20 476-493
[6]  
Koschke R(2007)Identifying similar pages in web applications using a competitive clustering algorithm J Softw Maint Evol Res Pract 19 281-296
[7]  
Antoniol G(2009)An investigation of clustering algorithms in the identification of similar web pages J Web Eng 8 346-370
[8]  
Krinke J(2006)On the effectiveness of clone detection by string matching J Softw Maint Evol Res Pract 18 37-58
[9]  
Merlo E(2008)Empirical evaluation of clone detection using syntax suffix trees Empir Softw Eng 13 601-643
[10]  
Bettenburg N(2002)CCFinder: a multilinguistic token-based code clone detection system for large scale source code IEEE Trans Softw Eng 28 654-670