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 条
  • [31] Causal Analysis for Supporting Users' Understanding of Investment Trusts
    Awano, Yuki
    Ma, Qiang
    Yoshikawa, Masatoshi
    16TH INTERNATIONAL CONFERENCE ON INFORMATION INTEGRATION AND WEB-BASED APPLICATIONS & SERVICES (IIWAS 2014), 2014, : 524 - 528
  • [32] A causal analysis of environmental familiarity on navigation information needs
    Akbari, Kamal
    Winter, Stephan
    Tomko, Martin
    INTERNATIONAL JOURNAL OF GEOGRAPHICAL INFORMATION SCIENCE, 2025, 39 (05) : 1128 - 1161
  • [33] Causal Analysis of the Emergent Behavior of a Hybrid Dynamical System
    Kvassay, Marcel
    Hluchy, Ladislav
    Krammer, Peter
    Schneider, Bernhard
    ACTA POLYTECHNICA HUNGARICA, 2014, 11 (04) : 21 - 40
  • [34] Causal Analysis of Artificial Intelligence Adoption in Project Management
    Sarafanov, Egor
    Valilai, Omid Fatahi
    Wicaksono, Hendro
    INTELLIGENT SYSTEMS AND APPLICATIONS, VOL 1, INTELLISYS 2023, 2024, 822 : 245 - 264
  • [35] Source Code Comprehension Analysis in Software Maintenance
    Al-Saiyd, Nedhal A.
    2017 2ND INTERNATIONAL CONFERENCE ON COMPUTER AND COMMUNICATION SYSTEMS (ICCCS2017), 2017, : 1 - 5
  • [36] PROGRAM ANALYSIS FOR CODE DUPLICATION IN LOGIC PROGRAMS
    Dandois, Celine
    TECHNICAL COMMUNICATIONS OF THE 26TH INTERNATIONAL CONFERENCE ON LOGIC PROGRAMMING (ICLP'10), 2010, 7 : 241 - 247
  • [37] Heart-rate monitoring by air pressure and causal analysis
    Tsuchiya, Naoki
    Nakajima, Hiroshi
    Hata, Yutaka
    INDEPENDENT COMPONENT ANALYSES, WAVELETS, NEURAL NETWORKS, BIOSYSTEMS, AND NANOENGINEERING IX, 2011, 8058
  • [38] Improvement of causal analysis using multivariate statistical process control
    Chang, Ching-Pao
    Chu, Chih-Ping
    SOFTWARE QUALITY JOURNAL, 2008, 16 (03) : 377 - 409
  • [39] Monthly Sectoral Electricity Demand Prediction Based on Causal Analysis
    Li L.
    Zhong H.
    Zhang G.
    Tan Z.
    Dianwang Jishu/Power System Technology, 2023, 47 (09): : 3629 - 3637
  • [40] Improvement of causal analysis using multivariate statistical process control
    Ching-Pao Chang
    Chih-Ping Chu
    Software Quality Journal, 2008, 16 : 377 - 409