Out of step: Code clone detection for mobile apps across different language codebases

IF 1.5 4区 计算机科学 Q3 COMPUTER SCIENCE, SOFTWARE ENGINEERING
Stephannie Jimenez , Gordana Rakić , Silvia Takahashi , Nicolás Cardozo
{"title":"Out of step: Code clone detection for mobile apps across different language codebases","authors":"Stephannie Jimenez ,&nbsp;Gordana Rakić ,&nbsp;Silvia Takahashi ,&nbsp;Nicolás Cardozo","doi":"10.1016/j.scico.2024.103112","DOIUrl":null,"url":null,"abstract":"<div><p>Clone detection provides insight about replicated fragments in a code base. With the rise of multi-language code bases, new techniques addressing cross-language code clone detection enable the analysis of polyglot systems. Such techniques have not yet been applied to the mobile apps' domain, which are naturally polyglot. Native mobile app developers must synchronize their code base in at least two different programming languages. App synchronization is a difficult and time-consuming maintenance task, as features can rapidly diverge between platforms, and feature identification must be performed manually. The end goal of this work is to provide an analysis framework to reduce the impact of app synchronization. A first step in this direction consists in a structural algorithm for cross-language clone detection, called <span>Out of Step</span>, exploiting the idea behind enriched concrete syntax trees. Such trees are used as a common intermediate representation built from programming languages' grammars, to detect similarities between app code bases. Our technique finds code similarities with over 80% for the evaluation of language features, where Type 1-3 clones are manually injected for the analysis of both single- and cross-language cases for Kotlin and Dart. We validate the feasibility and correctness of our approach through the evaluation of the main language constructs for Kotlin and Dart. To validate the effectiveness we use a first case study detecting clones between 12 sorting algorithms across Kotlin and Dart, identifying clone similarities with a precision between 67% and 95%. Finally, we use a corpus of 144 mobile apps implemented in Kotlin and Dart, correctly identifying code similarities for the full application logic.</p></div>","PeriodicalId":49561,"journal":{"name":"Science of Computer Programming","volume":"236 ","pages":"Article 103112"},"PeriodicalIF":1.5000,"publicationDate":"2024-04-03","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"https://www.sciencedirect.com/science/article/pii/S0167642324000352/pdfft?md5=9fb4baf02297c135f2162257609c5f70&pid=1-s2.0-S0167642324000352-main.pdf","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Science of Computer Programming","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0167642324000352","RegionNum":4,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0

Abstract

Clone detection provides insight about replicated fragments in a code base. With the rise of multi-language code bases, new techniques addressing cross-language code clone detection enable the analysis of polyglot systems. Such techniques have not yet been applied to the mobile apps' domain, which are naturally polyglot. Native mobile app developers must synchronize their code base in at least two different programming languages. App synchronization is a difficult and time-consuming maintenance task, as features can rapidly diverge between platforms, and feature identification must be performed manually. The end goal of this work is to provide an analysis framework to reduce the impact of app synchronization. A first step in this direction consists in a structural algorithm for cross-language clone detection, called Out of Step, exploiting the idea behind enriched concrete syntax trees. Such trees are used as a common intermediate representation built from programming languages' grammars, to detect similarities between app code bases. Our technique finds code similarities with over 80% for the evaluation of language features, where Type 1-3 clones are manually injected for the analysis of both single- and cross-language cases for Kotlin and Dart. We validate the feasibility and correctness of our approach through the evaluation of the main language constructs for Kotlin and Dart. To validate the effectiveness we use a first case study detecting clones between 12 sorting algorithms across Kotlin and Dart, identifying clone similarities with a precision between 67% and 95%. Finally, we use a corpus of 144 mobile apps implemented in Kotlin and Dart, correctly identifying code similarities for the full application logic.

脱节:跨不同语言代码库的移动应用程序代码克隆检测
克隆检测可以深入了解代码库中的复制片段。随着多语言代码库的兴起,解决跨语言代码克隆检测的新技术使分析多语言系统成为可能。此类技术尚未应用于移动应用程序领域,而移动应用程序天生就是多语言的。本地移动应用程序开发人员必须同步至少两种不同编程语言的代码库。应用程序同步是一项艰巨而耗时的维护任务,因为不同平台之间的功能可能会迅速出现差异,而且功能识别必须手动进行。这项工作的最终目标是提供一个分析框架,以减少应用程序同步的影响。在这个方向上迈出的第一步是利用丰富的具体语法树背后的理念,开发出一种用于跨语言克隆检测的结构性算法,称为 "失步"(Out of Step)。语法树是由编程语言语法构建的通用中间表示法,用于检测应用程序代码库之间的相似性。在评估语言特征时,我们的技术能发现 80% 以上的代码相似性,其中 1-3 类克隆是手动注入的,用于分析 Kotlin 和 Dart 的单语言和跨语言案例。我们通过评估 Kotlin 和 Dart 的主要语言结构验证了我们方法的可行性和正确性。为了验证其有效性,我们使用了第一个案例研究,检测 Kotlin 和 Dart 中 12 种排序算法之间的克隆,识别克隆相似性的精度在 67% 和 95% 之间。最后,我们使用了由 144 个使用 Kotlin 和 Dart 实现的移动应用程序组成的语料库,正确识别了完整应用逻辑的代码相似性。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
Science of Computer Programming
Science of Computer Programming 工程技术-计算机:软件工程
CiteScore
3.80
自引率
0.00%
发文量
76
审稿时长
67 days
期刊介绍: Science of Computer Programming is dedicated to the distribution of research results in the areas of software systems development, use and maintenance, including the software aspects of hardware design. The journal has a wide scope ranging from the many facets of methodological foundations to the details of technical issues andthe aspects of industrial practice. The subjects of interest to SCP cover the entire spectrum of methods for the entire life cycle of software systems, including • Requirements, specification, design, validation, verification, coding, testing, maintenance, metrics and renovation of software; • Design, implementation and evaluation of programming languages; • Programming environments, development tools, visualisation and animation; • Management of the development process; • Human factors in software, software for social interaction, software for social computing; • Cyber physical systems, and software for the interaction between the physical and the machine; • Software aspects of infrastructure services, system administration, and network management.
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信