Many web applications use a mixture of HTML and scripting language code as the front-end to business services, where scripts can run on both the client and server side. Analogously to traditional applications, code duplication occurs frequently during the development and evolution of web applications. This ad-hoc but pathological form of reuse consists in copying, and eventually modifying, a block of existing code that implements a piece of required functionality. Duplicated blocks are named clones and the act of copying, including slight modifications, is called cloning. When entire functions are copied rather than fragments, duplicated functions are called function clones. This paper describes how a semiautomated approach can be used to identify cloned functions within scripting code of web applications. The approach is based on the automatic selection of potential function clones and the visual inspection of selected script functions. The results obtained from the clone analysis of four web applications show that the semiautomated approach is both effective and efficient at identifying function clones in web applications, and can be applied to prevent clone from spreading or to remove redundant scripting code.
Function Clone Detection in Web Applications: A Semiautomated Approach
CALEFATO, FABIO;LANUBILE, Filippo;
2004-01-01
Abstract
Many web applications use a mixture of HTML and scripting language code as the front-end to business services, where scripts can run on both the client and server side. Analogously to traditional applications, code duplication occurs frequently during the development and evolution of web applications. This ad-hoc but pathological form of reuse consists in copying, and eventually modifying, a block of existing code that implements a piece of required functionality. Duplicated blocks are named clones and the act of copying, including slight modifications, is called cloning. When entire functions are copied rather than fragments, duplicated functions are called function clones. This paper describes how a semiautomated approach can be used to identify cloned functions within scripting code of web applications. The approach is based on the automatic selection of potential function clones and the visual inspection of selected script functions. The results obtained from the clone analysis of four web applications show that the semiautomated approach is both effective and efficient at identifying function clones in web applications, and can be applied to prevent clone from spreading or to remove redundant scripting code.I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.