Facebook pixel tracking

The Science and Information (SAI) Organization publishes open-access peer-reviewed journals in computer science and artificial intelligence.

Contact Info
Website thesai.org
Follow Us
Contact Info
Follow Us
Research Article | Open Access |

AI-Driven Refactoring: Semantic Reconstruction of Domain Models Using LLM Reasoning

Author 1: Mohamed El BOUKHARI Author 2: Nassim KHARMOUM Author 3: Soumia ZITI
International Journal of Advanced Computer Science and Applications (IJACSA) · Vol. 17, No. 2 · Published 2026

DOI: 10.14569/IJACSA.2026.0170283

Abstract

This study examines the application of large language models (LLMs) for automating domain layer reconstruction in legacy systems, with a specific focus on a case study involving water consumption management. The process begins with a deliberately disordered JSON representation that conflates domain, application, and infrastructure issues. An LLM, specifically GPT-5.2, was employed to identify misplaced methods, inconsistent naming, DTO misuse, incoherent aggregates, and unrelated modules, and subsequently reorganize the model into a structure aligned with Domain-Driven Design (DDD). The structure includes entities, value objects, aggregates, domain services, domain events, and repositories. The methodology involves encoding the legacy model as JSON, applying an LLM-based diagnosis and reconstruction pipeline, and producing both a refined domain model and a categorized catalogue of corrections. A comparative analysis of candidate LLMs, informed by recent code-centric benchmarks, such as SWE-bench and LiveCodeBench, supports the selection of GPT-5.2 as the primary model for this study. The findings indicate that the LLM can swiftly recover key domain concepts and achieve semantically consistent refactoring, a task that typically requires extensive manual effort. This suggests that LLM-assisted domain reconstruction is a promising adjunct to traditional refactoring practices and can facilitate continuous architectural improvements in organizations.

Keywords

How to Cite this Article

BOUKHARI, M. E., KHARMOUM, N., & ZITI, S. (2026). AI-Driven Refactoring: Semantic Reconstruction of Domain Models Using LLM Reasoning. International Journal of Advanced Computer Science and Applications, 17(2). https://doi.org/10.14569/IJACSA.2026.0170283

BOUKHARI, Mohamed El, et al.. "AI-Driven Refactoring: Semantic Reconstruction of Domain Models Using LLM Reasoning." International Journal of Advanced Computer Science and Applications, vol. 17, no. 2, 2026, https://doi.org/10.14569/IJACSA.2026.0170283.

@article{BOUKHARI2026,
  title     = {AI-Driven Refactoring: Semantic Reconstruction of Domain Models Using LLM Reasoning},
  journal   = {International Journal of Advanced Computer Science and Applications},
  volume    = {17},
  number    = {2},
  year      = {2026},
  publisher = {The Science and Information Organization},
  author    = {Mohamed El BOUKHARI and Nassim KHARMOUM and Soumia ZITI},
  doi       = {10.14569/IJACSA.2026.0170283},
  url       = {https://doi.org/10.14569/IJACSA.2026.0170283}
}

Open Access — licensed under a Creative Commons Attribution 4.0 International License. Unrestricted use, distribution, and reproduction in any medium, even commercially, as long as the original work is properly cited.

Call for Papers - Important Dates

Volume 17 No. 12, December 2026
Paper Submission Due November 25, 2026
Review Notification December 15, 2026
Publication Date December 31, 2026