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 条
  • [1] WHAT MAKES A BOOK READABLE
    Hallenbeck, Wilbur C.
    JOURNAL OF HIGHER EDUCATION, 1935, 6 (09): : 504 - 504
  • [2] What Makes a Book Readable
    Willcockson, Mary
    JOURNAL OF EDUCATIONAL RESEARCH, 1936, 29 (09): : 711 - 712
  • [3] WHAT MAKES A BOOK READABLE
    Ballard, Berton
    JOURNALISM QUARTERLY, 1935, 12 (03): : 327 - 328
  • [4] WHAT MAKES AN APPEALING AND READABLE SCIENCE BOOK
    LAUBER, P
    LION AND THE UNICORN, 1982, 6 : 5 - 9
  • [5] The Foreign Language Engineering Writer - What Makes a Readable Report?
    Dalton, David F.
    FIE: 2008 IEEE FRONTIERS IN EDUCATION CONFERENCE, VOLS 1-3, 2008, : 84 - 89
  • [6] GEORGES DIDI-HUBERMAN: "... WHAT MAKES THE TIME READABLE IS THE IMAGE"
    Duarte, Susana Nascimento
    Aparicio, Maria Irene
    CINEMA-JOURNAL OF PHILOSOPHY AND THE MOVING IMAGE, 2010, 1 : 118 - 133
  • [7] What Makes a Neural Code Convex?
    Curto, Carina
    Gross, Elizabeth
    Jeffries, Jack
    Morrison, Katherine
    Omar, Mohamed
    Rosen, Zvi
    Shiu, Anne
    Youngs, Nora
    SIAM JOURNAL ON APPLIED ALGEBRA AND GEOMETRY, 2017, 1 (01): : 222 - 238
  • [8] What Is Readable and What Is Not Readable in a Foreign Language?
    Russell, Harry J.
    MODERN LANGUAGE JOURNAL, 1950, 34 (04): : 270 - 275
  • [9] What Makes a Book Readable, with Special Reference to Adults of Limited Reading Ability
    Tompkins, Miriam D.
    LIBRARY JOURNAL, 1935, 60 (12) : 520 - +
  • [10] Towards readable code in neuroscience
    Riquelme, Juan Luis
    Gjorgjieva, Julijana
    NATURE REVIEWS NEUROSCIENCE, 2021, 22 (05) : 257 - 258