Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.
The massive number of open-source projects in public repositories has notably increased in the last years. Such repositories represent valuable information to be mined for different purposes, such as documenting recurrent syntactic constructs, analyzing the particular constructs used by experts and beginners, using them to teach programming and to detect bad programming practices, and building programming tools such as decompilers, Integrated Development Environments or Intelligent Tutoring Systems. An inherent problem of source code is that its syntactic information is represented with tree structures, while traditional machine learning algorithms use -dimensional datasets. Therefore, we present a feature engineering process to translate tree structures into homogeneous and heterogeneous n-dimensional datasets to be mined. Then, we run different interpretable (supervised and unsupervised) machine learning algorithms to mine the syntactic information of more than 17 million syntactic constructs in Java code. The results reveal interesting information such as the Java constructs that are barely (and widely) used (e.g., bitwise operators, union types and static blocks), different language features and patterns mostly (and barely) used by beginners (and experts), the discovery of particular types of source code (e.g., helper or utility classes, data transfer objects and too complex abstractions), and how complexity is an inherent characteristic in some clusters of syntactic constructs.
Francisco Ortin, Guillermo Facundo, Miguel Garcia,Analyzing syntactic constructs of Java programs with machine learning, Expert Systems with Applications,Volume 215,2023,https://doi.org/10.1016/j.eswa.2022.119398.
Published in Expert Systems with Applications, Volime 215, 1 April 2023.
CRediT authorship contribution statement
Francisco Ortin: Conceptualization, Methodology, Software, Validation, Formal analysis, Investigation, Resources, Data curation, Writing – original draft, Writing – review & editing, Visualization, Supervision, Project administration, Funding acquisition. Guillermo Facundo: Software, Investigation, Resources, Data curation, Writing – review & editing,Visualization. Miguel Garcia: Software, Validation, Investigation, Resources, Data curation, Writing – review & editing, Project administration, Funding acquisition.