Measuring code maintainability with deep neural networks

被引:4
|
作者
Hu, Yamin [1 ]
Jiang, Hao [2 ]
Hu, Zongyao [1 ]
机构
[1] Beijing Inst Technol, Sch Comp Sci & Technol, Beijing 100081, Peoples R China
[2] Anhui Univ, Sch Artificial Intelligence, Hefei 230601, Peoples R China
关键词
code maintainability; lexical semantics; deep learning; neural networks; SOFTWARE; METRICS; QUALITY;
D O I
10.1007/s11704-022-2313-0
中图分类号
TP [自动化技术、计算机技术];
学科分类号
0812 ;
摘要
The maintainability of source code is a key quality characteristic for software quality. Many approaches have been proposed to quantitatively measure code maintainability. Such approaches rely heavily on code metrics, e.g., the number of Lines of Code and McCabe's Cyclomatic Complexity. The employed code metrics are essentially statistics regarding code elements, e.g., the numbers of tokens, lines, references, and branch statements. However, natural language in source code, especially identifiers, is rarely exploited by such approaches. As a result, replacing meaningful identifiers with nonsense tokens would not significantly influence their outputs, although the replacement should have significantly reduced code maintainability. To this end, in this paper, we propose a novel approach (called DeepM) to measure code maintainability by exploiting the lexical semantics of text in source code. DeepM leverages deep learning techniques (e.g., LSTM and attention mechanism) to exploit these lexical semantics in measuring code maintainability. Another key rationale of DeepM is that measuring code maintainability is complex and often far beyond the capabilities of statistics or simple heuristics. Consequently, DeepM leverages deep learning techniques to automatically select useful features from complex and lengthy inputs and to construct a complex mapping (rather than simple heuristics) from the input to the output (code maintainability index). DeepM is evaluated on a manually-assessed dataset. The evaluation results suggest that DeepM is accurate, and it generates the same rankings of code maintainability as those of experienced programmers on 87.5% of manually ranked pairs of Java classes.
引用
收藏
页数:15
相关论文
共 50 条
  • [1] Measuring code maintainability with deep neural networks
    Yamin HU
    Hao JIANG
    Zongyao HU
    Frontiers of Computer Science, 2023, 17 (06) : 64 - 78
  • [2] The Delta Maintainability Model: Measuring Maintainability of Fine-Grained Code Changes
    di Biase, Marco
    Rastogi, Ayushi
    Bruntink, Magiel
    van Deursen, Arie
    2019 IEEE/ACM INTERNATIONAL CONFERENCE ON TECHNICAL DEBT (TECHDEBT 2019), 2019, : 113 - 122
  • [3] Optimized Code Generation for Deep Neural Networks
    Lake, Janaan
    Patabandi, Tharindu R.
    Hall, Mary
    LANGUAGES AND COMPILERS FOR PARALLEL COMPUTING, LCPC 2020, 2022, 13149 : 119 - 133
  • [4] Guided Code Synthesis using Deep Neural Networks
    Alexandru, Carol V.
    FSE'16: PROCEEDINGS OF THE 2016 24TH ACM SIGSOFT INTERNATIONAL SYMPOSIUM ON FOUNDATIONS OF SOFTWARE ENGINEERING, 2016, : 1068 - 1070
  • [5] QR CODE LOCALIZATION USING DEEP NEURAL NETWORKS
    Grosz, Tamas
    Bodnar, Peter
    Toth, Laszlo
    Nyul, Laszlo G.
    2014 IEEE INTERNATIONAL WORKSHOP ON MACHINE LEARNING FOR SIGNAL PROCESSING (MLSP), 2014,
  • [6] Measuring and Mitigating Local Instability in Deep Neural Networks
    Datta, Arghya
    Nandi, Subhrangshu
    Xu, Jingcheng
    Steeg, Greg Ver
    Xie, He
    Kumar, Anoop
    Galstyan, Aram
    FINDINGS OF THE ASSOCIATION FOR COMPUTATIONAL LINGUISTICS, ACL 2023, 2023, : 2810 - 2823
  • [7] Measuring Customer Behavior with Deep Convolutional Neural Networks
    Albu, Veaceslav
    BRAIN-BROAD RESEARCH IN ARTIFICIAL INTELLIGENCE AND NEUROSCIENCE, 2016, 7 (01): : 74 - 79
  • [8] Trademark Design Code Identification Using Deep Neural Networks
    Showkatramani, Girish J.
    Khatri, Nidhi
    Landicho, Arlene
    Layog, Darwin
    2018 17TH IEEE INTERNATIONAL CONFERENCE ON MACHINE LEARNING AND APPLICATIONS (ICMLA), 2018, : 61 - 65
  • [9] Source Code Authorship Identification Using Deep Neural Networks
    Kurtukova, Anna
    Romanov, Aleksandr
    Shelupanov, Alexander
    SYMMETRY-BASEL, 2020, 12 (12): : 1 - 17
  • [10] Are Deep Neural Networks the Best Choice for Modeling Source Code?
    Hellendoorn, Vincent J.
    Devanbu, Premkumar
    ESEC/FSE 2017: PROCEEDINGS OF THE 2017 11TH JOINT MEETING ON FOUNDATIONS OF SOFTWARE ENGINEERING, 2017, : 763 - 773