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 条
  • [21] Assessing the supply chain performance: a causal analysis
    Bayraktar, Erkan
    Sari, Kazim
    Tatoglu, Ekrem
    Zaim, Selim
    Delen, Dursun
    ANNALS OF OPERATIONS RESEARCH, 2020, 287 (01) : 37 - 60
  • [22] The effect of smoking on latent hazard classes of metabolic syndrome using latent class causal analysis method in the Iranian population
    Farzad Khodamoradi
    Maryam Nazemipour
    Nasrin Mansournia
    Kamran Yazdani
    Davood khalili
    Maedeh Arshadi
    Mahyar Etminan
    Mohammad Ali Mansournia
    BMC Public Health, 23
  • [23] A Distributed Data-Driven and Machine Learning Method for High-Level Causal Analysis in Sustainable IoT Systems
    Yu, Wangyang
    Zhang, Jing
    Liu, Lu
    Liu, Yuan
    Zhai, Xiaojun
    Howlader, Ruhul Kabir
    IEEE TRANSACTIONS ON SUSTAINABLE COMPUTING, 2025, 10 (02): : 274 - 286
  • [24] How to understand an action -: From causal analysis to norm-analysis
    Hydén, AH
    SOCIOLOGISK FORSKNING, 2002, 39 (3-4) : 10 - 31
  • [25] The effect of smoking on latent hazard classes of metabolic syndrome using latent class causal analysis method in the Iranian population
    Khodamoradi, Farzad
    Nazemipour, Maryam
    Mansournia, Nasrin
    Yazdani, Kamran
    Khalili, Davood
    Arshadi, Maedeh
    Etminan, Mahyar
    Mansournia, Mohammad Ali
    BMC PUBLIC HEALTH, 2023, 23 (01)
  • [26] Fine-grained Pseudo-code Generation Method via Code Feature Extraction and Transformer
    Yang, Guang
    Zhou, Yanlin
    Chen, Xiang
    Yu, Chi
    2021 28TH ASIA-PACIFIC SOFTWARE ENGINEERING CONFERENCE (APSEC 2021), 2021, : 213 - 222
  • [27] Tools for defect causal analysis A systematic literatura review
    Arreche, Santiago
    Matalonga, Santiago
    San Feliu, Toms
    7TH IBERIAN CONFERENCE ON INFORMATION SYSTEMS AND TECHNOLOGIES (CISTI 2012), 2012,
  • [28] AN APPLICATION OF CAUSAL-ANALYSIS TO THE SOFTWARE MODIFICATION PROCESS
    COLLOFELLO, JS
    GOSALIA, BP
    GOSALIA, BP
    SOFTWARE-PRACTICE & EXPERIENCE, 1993, 23 (10) : 1095 - 1105
  • [29] Implementary process framework of causal analysis based on CMMI
    Zhang Feng-jing
    Ren Ai-hua
    Proceedings of the 2007 Chinese Control and Decision Conference, 2007, : 857 - 860
  • [30] Contemporary Terrorism Manifestations (Simple Causal Model Analysis)
    Novotny, Tomas
    VOJENSKE ROZHLEDY-CZECH MILITARY REVIEW, 2019, 28 (04): : 95 - 105