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 条
  • [31] Cracking the genetic code with neural networks
    Joiret, Marc
    Leclercq, Marine
    Lambrechts, Gaspard
    Rapino, Francesca
    Close, Pierre
    Louppe, Gilles
    Geris, Liesbet
    FRONTIERS IN ARTIFICIAL INTELLIGENCE, 2023, 6
  • [32] The Effect of Pair Programming on Code Maintainability
    Nawahdah, Mamoun
    Jaradat, Majdi
    COLLABORATION TECHNOLOGIES AND SOCIAL COMPUTING, COLLABTECH 2022, 2022, 13632 : 38 - 51
  • [33] Code-to-Code Search Based on Deep Neural Network and Code Mutation
    Fujiwara, Yuji
    Yoshida, Norihiro
    Choi, Eunjong
    Inoue, Katsuro
    2019 IEEE 13TH INTERNATIONAL WORKSHOP ON SOFTWARE CLONES (IWSC '19), 2019, : 1 - 7
  • [34] Implementing Deep Convolutional Neural Networks for QR Code-Based Printed Source Identification
    Tsai, Min-Jen
    Lee, Ya-Chu
    Chen, Te-Ming
    ALGORITHMS, 2023, 16 (03)
  • [35] Investigating Bilingual Deep Neural Networks for Automatic Recognition of Code-switching Frisian Speech
    Yilmaz, Emre
    van den Heuvel, Henk
    van Leeuwen, David
    SLTU-2016 5TH WORKSHOP ON SPOKEN LANGUAGE TECHNOLOGIES FOR UNDER-RESOURCED LANGUAGES, 2016, 81 : 159 - 166
  • [36] On Numerosity of Deep Neural Networks
    Zhang, Xi
    Wu, Xiaolin
    ADVANCES IN NEURAL INFORMATION PROCESSING SYSTEMS 33, NEURIPS 2020, 2020, 33
  • [37] On the Singularity in Deep Neural Networks
    Nitta, Tohru
    NEURAL INFORMATION PROCESSING, ICONIP 2016, PT IV, 2016, 9950 : 389 - 396
  • [38] Topology of Deep Neural Networks
    Naitzat, Gregory
    Zhitnikov, Andrey
    Lim, Lek-Heng
    JOURNAL OF MACHINE LEARNING RESEARCH, 2020, 21
  • [39] Topology of deep neural networks
    1600, Microtome Publishing (21):
  • [40] Tracking with Deep Neural Networks
    Kucharczyk, Marcin
    Wolter, Marcin
    PHOTONICS APPLICATIONS IN ASTRONOMY, COMMUNICATIONS, INDUSTRY, AND HIGH-ENERGY PHYSICS EXPERIMENTS 2019, 2019, 11176