Summary
Software projects often get messy over time, with files not clearly belonging to parts of the system as originally planned, making it hard to manage the system's architecture. The authors studied how machine learning, especially graph-based neural networks, can help assign files back to their architectural modules by looking at how files depend on each other and other clues. They tested several kinds of models across many real software projects and found that including the file dependency structure helps most for big, well-connected projects. Different models worked better in different cases, but overall, using the graph of file dependencies improved the accuracy of mapping files to their intended architectural parts.
What this means in practice
- •For software maintainers: Automatically map source files to architectural modules to detect and manage architecture drift in large codebases.
- •For software quality teams: Use dependency-graph-based learning to identify files that violate modular boundaries and reduce technical debt.
Authors
Rakhshanda Jabeen, Morgan Ericsson, Jonas Nordqvist, Anna Wingkvist
Abstract
Architectural technical debt arises when a system's implementation drifts from its inten ded modular decomposition, while the mapping between source files and architectural modu les is missing, incomplete, or costly to maintain manually. We formulate code-to-archite cture mapping as semi-supervised node classification over a directed multi-relational de pendency graph, with files as nodes, typed dependencies as edges, and lexical features d erived from code identifiers and directory layout. Starting from a small labeled sample, an iterative self-training procedure expands the mapping to the remaining files. We com pare a graph convolutional network (GCN), a graph attention network (GAT), and a graph-f ree multi-layer perceptron (MLP), using identical features and training procedures for t he learned models, against a Naive Bayes reference. Across 100 runs on ten open-source J ava and C/C++ systems, all three neural models outperform the reference on both F1 metri cs. GAT achieves the highest averages of system-level median macro and micro F1, at 83.5 and 92.2, respectively, whereas MLP remains competitive or superior on several systems. On Chrome, the largest system with 18,343 files, GAT and GCN exceed MLP by 22 and 19 ma cro-F1 points, respectively, and have substantially fewer persistently misclassified fil es. Connectivity and homophily are associated with where neural message passing helps, w hile multi-relational aggregation outperforms a single merged edge type on every system for both GCN and GAT. A follow-up study finds that several model rankings depend on the training seed, qualifying smaller advantages without removing the large graph benefit ob served on Chrome.