Just-in-time code duplicates extraction

被引:3
|
作者
AlOmar, Eman Abdullah [1 ]
Ivanov, Anton [2 ]
Kurbatova, Zarina [3 ]
Golubev, Yaroslav [3 ]
Mkaouer, Mohamed Wiem [4 ]
Ouni, Ali [5 ]
Bryksin, Timofey [6 ]
Nguyen, Le [4 ]
Kini, Amit [4 ]
Thakur, Aditya [4 ]
机构
[1] Stevens Inst Technol, Hoboken, NJ 07030 USA
[2] HSE Univ, Moscow, Russia
[3] JetBrains Res, Belgrade, Serbia
[4] Rochester Inst Technol, Rochester, NY USA
[5] Univ Quebec, ETS Montreal, Montreal, PQ, Canada
[6] JetBrains Res, Limassol, Cyprus
关键词
Refactoring; Machine learning; Software quality; METHOD REFACTORING OPPORTUNITIES; IDENTIFICATION; CLONES;
D O I
10.1016/j.infsof.2023.107169
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
Context: Refactoring is a critical task in software maintenance, and is usually performed to enforce better design and coding practices, while coping with design defects. The ExtractMethod refactoring is widely used for merging duplicate code fragments into a single new method. Several studies attempted to recommend Extract Method refactoring opportunities using different techniques, including program slicing, program dependency graph analysis, change history analysis, structural similarity, and feature extraction. However, irrespective of the method, most of the existing approaches interfere with the developer's workflow: they require the developer to stop coding and analyze the suggested opportunities, and also consider all refactoring suggestions in the entire project without focusing on the development context.Objective: To increase the adoption of the ExtractMethod refactoring, in this paper, we aim to investigate the effectiveness of machine learning and deep learning algorithms for its recommendation while maintaining the workflow of the developer. Method: The proposed approach relies on mining prior applied Extract Method refactorings and extracting their features to train a deep learning classifier that detects them in the user's code. We implemented our approach as a plugin for IntelliJ IDEA called AnTiCOPYPASTER. To develop our approach, we trained and evaluated various popular models on a dataset of 18,942 code fragments from 13 Open Source Apache projects.Results: The results show that the best model is the Convolutional Neural Network (CNN), which recommends appropriate Extract Method refactorings with an F-measure of 0.82. We also conducted a qualitative study with 72 developers to evaluate the usefulness of the developed plugin.Conclusion: The results show that developers tend to appreciate the idea of the approach and are satisfied with various aspects of the plugin's operation.
引用
收藏
页数:14
相关论文
共 50 条
  • [41] kR∧X: Comprehensive Kernel Protection against Just-In-Time Code Reuse
    Pomonis, Marios
    Petsios, Theofilos
    Keromytis, Angelos D.
    Polychronakis, Michalis
    Kemerlis, Vasileios P.
    PROCEEDINGS OF THE TWELFTH EUROPEAN CONFERENCE ON COMPUTER SYSTEMS (EUROSYS 2017), 2017, : 420 - 436
  • [42] Boosting Just-In-Time Code Comment Updating Via Programming Context and Refactor
    Mi, Xiangbo
    Zhang, Jingxuan
    Tang, Yixuan
    Ju, Yue
    Lan, Jinpeng
    INTERNATIONAL JOURNAL OF SOFTWARE ENGINEERING AND KNOWLEDGE ENGINEERING, 2023, 33 (10) : 1619 - 1649
  • [43] Isomeron: Code Randomization Resilient to (Just-In-Time) Return-Oriented Programming
    Davi, Lucas
    Liebchen, Christopher
    Sadeghi, Ahmad-Reza
    Snow, Kevin Z.
    Monrose, Fabian
    22ND ANNUAL NETWORK AND DISTRIBUTED SYSTEM SECURITY SYMPOSIUM (NDSS 2015), 2015,
  • [44] Leveraging structural properties of source code graphs for just-in-time bug prediction
    Md Nadim
    Debajyoti Mondal
    Chanchal K. Roy
    Automated Software Engineering, 2022, 29
  • [45] Leveraging structural properties of source code graphs for just-in-time bug prediction
    Nadim, Md
    Mondal, Debajyoti
    Roy, Chanchal K.
    AUTOMATED SOFTWARE ENGINEERING, 2022, 29 (01)
  • [46] A Just-In-Time Software Defect Localization Method Based On Code Graph Representation
    Zhang, Huan
    Min, Weihuan
    Wei, Zhao
    Kuang, Li
    Gao, Honghao
    Miao, Huaikou
    PROCEEDINGS 2024 32ND IEEE/ACM INTERNATIONAL CONFERENCE ON PROGRAM COMPREHENSION, ICPC 2024, 2024, : 293 - 303
  • [47] Leveraging structural properties of source code graphs for just-in-time bug prediction
    Nadim, Md
    Mondal, Debajyoti
    Roy, Chanchal K.
    arXiv, 2022,
  • [48] Delivering just-in-time performance: applying just-in-time logic to rail and intermodal operations
    Foyer, P
    Mortimer, PN
    DEVELOPING AND GROWING THE BUSINESS - FREIGHT: INTERNATIONAL RAILTECH CONGRESS '98, 1998, 1998 (18): : 35 - 41
  • [49] Code-centric learning-based just-in-time vulnerability detection
    Nguyen, Son
    Nguyen, Thu-Trang
    Vu, Thanh Trong
    Do, Thanh-Dat
    Ngo, Kien-Tuan
    Vo, Hieu Dinh
    JOURNAL OF SYSTEMS AND SOFTWARE, 2024, 214
  • [50] Using Just-in-Time Code Generation for Transparent Resource Management in Heterogeneous Systems
    Riebler, Heinrich
    Vaz, Gavin
    Plessl, Christian
    Trainiti, Ettore M. G.
    Durelli, Gianluca C.
    Del Sozzo, Emanuele
    Santambrogio, Marco D.
    Bolchini, Cristiana
    2016 IEEE 2ND INTERNATIONAL FORUM ON RESEARCH AND TECHNOLOGIES FOR SOCIETY AND INDUSTRY LEVERAGING A BETTER TOMORROW (RTSI), 2016, : 1 - 5