What makes a readable code? A causal analysis method

被引:2
作者
Mi, Qing [1 ]
Chen, Mingjie [2 ]
Cai, Zhi [1 ,3 ]
Jia, Xibin [1 ]
机构
[1] Beijing Univ Technol, Fac Informat Technol, Beijing, Peoples R China
[2] South China Univ Technol, Sch Software Engn, Guangzhou, Peoples R China
[3] Beijing Univ Technol, Fac Informat Technol, 100 Pingleyuan,Chaoyang Dist, Beijing, Peoples R China
基金
北京市自然科学基金; 新加坡国家研究基金会;
关键词
causal analysis; code readability; PC algorithm; program comprehension;
D O I
10.1002/spe.3192
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Context:Code readability is one of the most important quality attributes for software source code. To investigate which features affect code readability, most existing studies rely on correlation-based methods. However, spurious correlations (a mathematical relationship wherein two variables appear to be causal but are not) involved in correlation-based methods may affect research conclusions. Objective:In order to remove spurious correlations and obtain conclusions from the perspective of causation as to what makes a readable code, we propose a causal theory-based approach to analyze the relationship between code features and code readability scores. Method:First, we adopt the PC algorithm and additive noise models to construct the causal graph on the basis of the selected code features. Then, we use the linear regression algorithm based on the back-door criterion to obtain the causal effect of different features on code readability. Result:We conduct a set of experiments on readability data labeled by human annotators. The experimental results show that the average number of comments positively impacts code readability, with each additional unit increasing the code readability score by 0.799 points. Whereas the average number of assignments, identifiers, and periods have a negative impact, with each additional unit decreasing the code readability score by 0.528, 0.281, and 0.170 points respectively. Conclusion:We believe that our findings will provide developers with a better understanding of the patterns behind code readability, and guide developers to optimize their code as the ultimate goal.
引用
收藏
页码:1391 / 1409
页数:19
相关论文
共 50 条
  • [41] Causal analysis of illegal parking in urban roads: The case of Greece
    Zoika, Stefania
    Tzouras, Panagiotis G.
    Tsigdinos, Stefanos
    Kepaptsoglou, Konstantinos
    CASE STUDIES ON TRANSPORT POLICY, 2021, 9 (03) : 1084 - 1096
  • [42] Impacts of agricultural land use on biological integrity: a causal analysis
    Riseng, C. M.
    Wiley, M. J.
    Black, R. W.
    Munn, M. D.
    ECOLOGICAL APPLICATIONS, 2011, 21 (08) : 3128 - 3146
  • [43] Causal Analysis of Impact Factors of COVID-19 in China
    Tang, Wen-Xun
    Li, Haifeng
    Hai, Mo
    Zhang, Yuejin
    8TH INTERNATIONAL CONFERENCE ON INFORMATION TECHNOLOGY AND QUANTITATIVE MANAGEMENT (ITQM 2020 & 2021): DEVELOPING GLOBAL DIGITAL ECONOMY AFTER COVID-19, 2022, 199 : 1483 - 1489
  • [44] Modeling of Precipitation Prediction Based on Causal Analysis and Machine Learning
    Li, Hongchen
    Li, Ming
    ATMOSPHERE, 2023, 14 (09)
  • [45] Trace Mining from Distributed Assembly Databases for Causal Analysis
    Hido, Shohei
    Matsuzawa, Hirofumi
    Kitayama, Fumihiko
    Numao, Masayuki
    ADVANCES IN KNOWLEDGE DISCOVERY AND DATA MINING, PROCEEDINGS, 2009, 5476 : 731 - +
  • [46] Kausalanalyse mit maschinellem LernenCombining Causal Analysis with Machine Learning
    Martin Huber
    HMD Praxis der Wirtschaftsinformatik, 2020, 57 (1) : 106 - 116
  • [47] Causal analysis of fetal death in high-risk pregnancies
    Aguinaga, Monica
    Valdespino, Yolotzin
    Medina, Daniela
    Espino y Sosa, Salvador
    Sevilla, Rosalba
    Miranda, Osvaldo
    Acevedo, Sandra
    Monroy, Irma E.
    Helguera, Addy C.
    Perez, Javier
    Mariscal, Luisa F.
    Murillo, Mauricio R.
    Lara, Rosa M.
    Armijos, Jessica C.
    Rogel, Gabriela
    Cardona, Jorge A.
    JOURNAL OF PERINATAL MEDICINE, 2021, 49 (06) : 740 - 747
  • [48] Linking Bayesian networks and PLS path modeling for causal analysis
    Wu, Wei Wen
    EXPERT SYSTEMS WITH APPLICATIONS, 2010, 37 (01) : 134 - 139
  • [49] Causal Analysis of System Failures from IT Project Trouble Reports
    Shimoda, A.
    2015 IEEE INTERNATIONAL CONFERENCE ON INDUSTRIAL ENGINEERING AND ENGINEERING MANAGEMENT (IEEM), 2015, : 1302 - 1306
  • [50] A Framework for Crowd-based Causal Analysis of Open Data
    Song, Jing
    Oyama, Satoshi
    Kurihara, Masahito
    2018 IEEE INTERNATIONAL CONFERENCE ON SYSTEMS, MAN, AND CYBERNETICS (SMC), 2018, : 2188 - 2193