From Code to Architecture: Responsibility Analysis and Dependency Graphs in the Inference of Architectural Patterns in Kotlin
Abstract
Understanding software architecture is essential for maintenance and evolution. However, architectural decisions are often undocumented or outdated, forcing developers to infer architectural structures directly from source code. This task is challenging due to inconsistent naming, variable code quality, architectural erosion, hybrid styles, and the lack of systematic identification methods. In this work, we propose an automated pipeline to infer architectural patterns directly from Kotlin source code. The approach combines static code analysis, heuristic identification of class responsibilities, and dependency graph construction to capture both the roles of individual components and the structural relationships between them. Based on this representation, the pipeline is able to identify architectural patterns such as MVVM, MVP, MVC, MVI, and VIPER. To evaluate the effectiveness of the proposed approach, we conducted an empirical study using a dataset of Kotlin repositories collected from GitHub. The evaluation was performed on a statistically representative sample, comparing the inferred architectures with those explicitly declared by the repository authors. The results show that the pipeline achieves an accuracy of 69.8%, significantly outperforming benchmark strategies such as random and majority class classifiers. These results indicate that combining responsibility analysis with dependency-based structural representations provides a robust and scalable solution for inferring architectural patterns. The proposed approach can aid in software maintenance, architectural analysis, and large-scale empirical studies in modern software ecosystems.
Create a lesson
Metadata
- Journal
- Proceedings of the 40th Brazilian Symposium on Software Engineering (SBES 2026), São Paulo, Brazil, pp. 531-541
- Comments
- 11 pages, 1 figure, 4 tables. Accepted at the 40th Brazilian Symposium on Software Engineering (SBES 2026)
Related papers
Managing Specification. Not code: A feasibility study of Graph -> Contract -> Code Deployment and Maintenance
Shared title terminologycs.SEHenry Yeung
DUPLEX: A Dual-Plane Architecture for Monitored and Staged Repo-Level Code Repair
Shared title terminologycs.SEYinuo Deng, Kaiyu Deng, Hanchen Wang et al.
Does the Agent's Map Match the Territory? Architectural Claims in AI Agent Context Files and Their Fit with the Code
Shared title terminologycs.SEBachan Ghimire, Daniela Damian
Analyzing and Clarifying Software Change Intentions via Project Asset Dependency Mining
Shared title terminologycs.SEYingtao Fang, Zhi Jin, Tiankuo Zhao et al.
Evaluating Code Slop in Long-Horizon Coding Agents
Shared title terminologycs.SEShubham Gandhi, Shyam Agarwal, Nachiket Kotalwar et al.
ReleaseSynth: Scaling Data from Software Evolution for Long-Horizon Coding Agents
Shared title terminologycs.SEMan Ho Lam, Chaozheng Wang, Zongjie Li et al.