TL;DR
SARIF is a new automated tool that recovers software architecture by fusing three distinct signals: fine-grained code dependencies, textual information (via topic modeling), and folder structures. By using an adaptive weighting scheme and refined graph algorithms, it achieves a 36.1% improvement in accuracy over state-of-the-art techniques.
What Problem Does This Paper Address?
As software systems evolve, they inevitably suffer from architectural drift and erosion—the gap between the original design and the actual implementation. For architects, understanding the "as-built" architecture is critical for maintenance, but doing so manually is a Herculean task that can take hundreds of hours for large codebases.
Existing automated recovery tools (which cluster code entities into high-level components) generally suffer from two flaws:
- Information Scarcity: Most tools rely on only one or two signals (usually just structural dependencies), ignoring the rich context provided by directory structures or developer comments.
- Coarse Granularity: They often treat all code relationships as equal. In reality, a "Function Call" provides much more architectural insight than a simple "Variable Use," yet many tools don't distinguish between them.
Methods
The authors propose SARIF (Software Architecture Recovery with Information Fusion), which operates in four main stages:
- Information Extraction: It extracts fine-grained dependencies (13 different types), source code text (comments, class/function names), and the directory tree.
- Information Refinement: This is where the "intelligence" happens.
- SARIF uses Inversed PageRank (IPR) to identify influential nodes (like module interfaces) rather than just "popular" utility functions.
- It employs an optimization algorithm to automatically assign weights to different dependency types (e.g.,
ImplLinkis weighted much higher thanUse). - It uses Latent Dirichlet Allocation (LDA) to transform raw code text into topic embeddings.
- Information Fusion: Not all signals are useful for every project. SARIF calculates a dynamic weight for textual and folder information by comparing how well they align with the structural dependency graph. If a folder structure is messy, SARIF automatically down-weights it.
- Clustering: Finally, it fuses these signals into a single weighted graph and applies a fast community detection algorithm to partition the system into architectural modules.
Datasets
The study uses a robust two-part evaluation:
- Benchmark Projects: 9 software systems with human-labeled ground-truth architectures. This includes 6 established benchmarks (like Hadoop, Chromium, and Bash) and 3 new projects labeled by industrial collaborators (Libxml2, Distributed Camera, and Drivers Framework).
- Generalizability Set: A massive collection of 900 GitHub projects across C, C++, and Java to verify that the tool works across different languages and scales.
Key Insights and Ideas
- The Utility Function Trap: Standard PageRank often flags utility functions (like
string_equal) as "important" because they are called everywhere. SARIF’s use of Inversed PageRank correctly identifies that the callers of many functions (the interfaces) are the true architectural anchors. - Context Matters: Folder structures are often great indicators of architecture, but sometimes they are misleading (e.g., putting all header files in one
includefolder). SARIF’s ability to adaptively filter these "useless" folders prevents them from polluting the recovery result. - Metric Reform: The authors argue that common metrics like MoJoFM and $a2a$ are biased or have limited dynamic range. They introduce Adjusted Rand Index (ARI) and a new adjusted $a2a$ ($a2a_{adj}$) to provide a more "honest" assessment of how similar two architectures really are.
Key Results
- Superior Accuracy: SARIF outperformed nine state-of-the-art techniques, showing a 36.1% average improvement in accuracy across all metrics.
- Top Performance: Out of 40 experimental runs (8 projects × 5 metrics), SARIF achieved the #1 score in 77.8% of cases and a Top-2 score in 88.9% of cases.
- Scalability: The tool is highly efficient. It processed the Chromium codebase (over 10 million lines of code) in approximately 80 minutes, with the vast majority of that time spent on initial information extraction.
- Ablation Success: Removing any single component (text, folders, or dependency weighting) led to a significant drop in accuracy, proving that "information fusion" is indeed the key to its success.
Limitations and Future Work
- Granularity Mismatch: In one project (OODT), SARIF’s default settings produced far fewer clusters than the ground truth. While the authors showed that adjusting a "resolution" parameter fixes this, the tool currently lacks an automated way to guess the "correct" number of clusters a human might expect.
- Static Analysis Bounds: Like all tools relying on static analysis, SARIF may struggle with highly dynamic language features or complex pointer indirection that obscures dependencies.
- Future Directions: The authors suggest incorporating more explicit domain knowledge and commonly-adopted architectural patterns (like Model-View-Controller) to further refine the clustering logic.
Summary updated