Please use this identifier to cite or link to this item: http://hdl.handle.net/1783.1/62300

Code clone studies in JavaScript applications

Authors Cheung, Wai Ting
Issue Date 2013
Summary Code cloning is one of the active research areas in the software engineering literature. Specifically, previous literature conducted many empirical studies on code cloning and reported that 7% to 23% of the code in a typical software system has been cloned. However, as web technology was less dominant in the past, there was less awareness on code clones in dynamic languages and most studies are limited to static languages such as Java, C, and C++. In addition, from a software maintenance point of view, code clones carry important domain knowledge about the understandability and reusability of similar systems. Nevertheless, 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 dynamic languages such as JavaScript in different application domains. In this thesis, we report a large-scale clone detection experiment in a dynamic programming language, JavaScript, for different application domains, web pages and standalone projects. We found that unlike JavaScript standalone projects, JavaScript in web pages contains various symptoms that indicate bad maintainability including 46% of widely scattered clones and 57% of function-level clones. We also found that JavaScript applications contain 60% to 90% of consistent clones, and they are easily refactorable. Our findings suggest the need of simple module systems for refactoring JavaScript applications. We propose a refactoring approach to automatically extract modules in JavaScript applications by leveraging code clone analysis. We evaluated our approach on 29 JavaScript web pages and 27 JavaScript standalone projects by software quality and developers’ acceptability. Our experiment results show that our approach helps to improve the understandability by 1 – 20% and complexity by 1 – 35%, and developers have higher acceptability in the modules extracted by our approach.
Note Thesis (M.Phil.)--Hong Kong University of Science and Technology, 2013
Subjects
Language English
Format Thesis
Access View full-text via DOI
Files in this item:
File Description Size Format
th_redirect.html 346 B HTML
Copyrighted to the author. Reproduction is prohibited without the author’s prior written consent.