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
来源
SOFTWARE-PRACTICE & EXPERIENCE | 2023年 / 53卷 / 06期
基金
北京市自然科学基金; 新加坡国家研究基金会;
关键词
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] Less is more: information needs, information wants, and what makes causal models useful
    Samantha Kleinberg
    Jessecae K. Marsh
    Cognitive Research: Principles and Implications, 8
  • [32] Consensus in the delphi method: What makes a decision change?
    Barrios, Maite
    Guilera, Georgina
    Nuno, Laura
    Gomez-Benito, Juana
    TECHNOLOGICAL FORECASTING AND SOCIAL CHANGE, 2021, 163
  • [33] What makes a model prescriber? A documentary analysis
    Omer, Usmaan
    Veysey, Martin
    Crampton, Paul
    Finn, Gabrielle
    MEDICAL TEACHER, 2021, 43 (02) : 198 - 207
  • [34] WHAT MAKES THE TRAINING ANALYSIS GOOD ENOUGH
    BERNARDI, R
    NIETO, M
    INTERNATIONAL REVIEW OF PSYCHO-ANALYSIS, 1992, 19 : 137 - 146
  • [35] WHAT MAKES TRAINING ANALYSIS GOOD ENOUGH
    LIMENTANI, A
    INTERNATIONAL REVIEW OF PSYCHO-ANALYSIS, 1992, 19 : 133 - 135
  • [36] What Adorno makes possible for music analysis
    Agawu, K
    NINETEENTH CENTURY MUSIC, 2005, 29 (01): : 49 - 55
  • [37] A Directly Readable Halftone Multifunctional Color QR Code
    Huang Yuan
    Cao Peng
    Lyu Guangwu
    CHINESE JOURNAL OF ELECTRONICS, 2023, 32 (03) : 474 - 484
  • [38] A Directly Readable Halftone Multifunctional Color QR Code
    HUANG Yuan
    CAO Peng
    LYU Guangwu
    ChineseJournalofElectronics, 2023, 32 (03) : 474 - 484
  • [39] What makes me happy, and what makes me scared? An analysis of drawings made by Norwegian and Palestinian children
    Maagero, Eva
    Sunde, Tone
    EUROPEAN EARLY CHILDHOOD EDUCATION RESEARCH JOURNAL, 2016, 24 (02) : 287 - 304
  • [40] Code Blue:: What Makes a Difference?: Forty years of in-hospital CPR.
    Winslow, EH
    Beall, J
    Winslow, EH
    Jacobson, AF
    AMERICAN JOURNAL OF NURSING, 2001, 101 (01) : 24M - +