This paper conducts an empirical study on students'code modification behaviors in incremental programming projects by analyzing 40771 code submissions from 371 students through abstract syntax tree(AST)difference ...This paper conducts an empirical study on students'code modification behaviors in incremental programming projects by analyzing 40771 code submissions from 371 students through abstract syntax tree(AST)difference analysis and manual annotation.The study investigates the distribution of code modification types to prior-phase code during iterative development,identifies cross-phase error types,and analyzes refactoring strategies.The findings reveal that error correction and code refactoring constitute the primary types of cross-phase code modifications.Among cross-phase latent errors,special case neglect represents the dominant error type,indicating insufficient coverage of special scenarios in existing test suites.Variable renaming emerges as the most prevalent refactoring behavior,reflecting students'emphasis on code readability.These research findings provide empirical evidence for optimizing incremental curriculum design,improving test cases,and cultivating students'code maintenance capabilities in programming education.展开更多
Methods in programs must be accurately named to facilitate source code analysis and comprehension.With the evolution of software,method names may be inconsistent with their implemented method bodies,leading to inaccur...Methods in programs must be accurately named to facilitate source code analysis and comprehension.With the evolution of software,method names may be inconsistent with their implemented method bodies,leading to inaccurate or buggy method names.Debugging method names remains an important topic in the literature.Although researchers have proposed several approaches to suggest accurate method names once the method bodies have been modified,two main drawbacks remain to be solved:there is no analysis of method name structure,and the programming context information is not captured efficiently.To resolve these drawbacks and suggest more accurate method names,we propose a novel automated approach based on the analysis of the method name structure and lexical analysis with the programming context information.Our approach first leverages deep feature representation to embed method names and method bodies in vectors.Then,it obtains useful verb-tokens from a large method corpus through structural analysis and noun-tokens from method bodies through lexical analysis.Finally,our approach dynamically combines these tokens to form and recommend high-quality and project-specific method names.Experimental results over 2111 Java testing methods show that the proposed approach can achieve a Hit Ratio,or Hit@5,of 33.62%and outperform the state-of-the-art approach by 14.12%in suggesting accurate method names.We also demonstrate the effectiveness of structural and lexical analyses in our approach.展开更多
基金supported by the National Natural Science Foundation of China(Nos.62577007 and 92582204)。
摘要This paper conducts an empirical study on students'code modification behaviors in incremental programming projects by analyzing 40771 code submissions from 371 students through abstract syntax tree(AST)difference analysis and manual annotation.The study investigates the distribution of code modification types to prior-phase code during iterative development,identifies cross-phase error types,and analyzes refactoring strategies.The findings reveal that error correction and code refactoring constitute the primary types of cross-phase code modifications.Among cross-phase latent errors,special case neglect represents the dominant error type,indicating insufficient coverage of special scenarios in existing test suites.Variable renaming emerges as the most prevalent refactoring behavior,reflecting students'emphasis on code readability.These research findings provide empirical evidence for optimizing incremental curriculum design,improving test cases,and cultivating students'code maintenance capabilities in programming education.
基金Project supported by the National Natural Science Foundation of China(Nos.61902181 and 62002161)the China Postdoctoral Science Foundation(No.2020M671489)+1 种基金the CCF-Tencent Open Research Fund(No.RAGR20200106)and the Nanjing University of Aeronautics and Astronautics Postgraduate Research and Practice Innovation Program(No.xcxjh20211612)。
摘要Methods in programs must be accurately named to facilitate source code analysis and comprehension.With the evolution of software,method names may be inconsistent with their implemented method bodies,leading to inaccurate or buggy method names.Debugging method names remains an important topic in the literature.Although researchers have proposed several approaches to suggest accurate method names once the method bodies have been modified,two main drawbacks remain to be solved:there is no analysis of method name structure,and the programming context information is not captured efficiently.To resolve these drawbacks and suggest more accurate method names,we propose a novel automated approach based on the analysis of the method name structure and lexical analysis with the programming context information.Our approach first leverages deep feature representation to embed method names and method bodies in vectors.Then,it obtains useful verb-tokens from a large method corpus through structural analysis and noun-tokens from method bodies through lexical analysis.Finally,our approach dynamically combines these tokens to form and recommend high-quality and project-specific method names.Experimental results over 2111 Java testing methods show that the proposed approach can achieve a Hit Ratio,or Hit@5,of 33.62%and outperform the state-of-the-art approach by 14.12%in suggesting accurate method names.We also demonstrate the effectiveness of structural and lexical analyses in our approach.