Refactoring to Standard C++20 Modules

Richárd Szalay,Zoltán Porkoláb
DOI: https://doi.org/10.1002/smr.2736
2024-12-01
Journal of Software Evolution and Process
Abstract:This paper investigates a semi‐automatic modularization method to refactor existing C++ projects. Our approach uses dependency analysis and clustering to organize elements of projects into modules, without domain‐specific information. To fully facilitate the use of Modules, it is likely that both project‐internal and user‐facing interfaces must be changed. Good component‐based design for software projects is a desired property both for development and maintenance. The C++ programming language inherited the "translation unit" model from C, where every source file is individually compiled with no knowledge about other parts of the project. This model has several drawbacks, and C++20 Modules is the Standard's answer for them. Moreover, Modules allows a cleaner encapsulation of concern. This paper investigates a semi‐automatic modularization method to refactor existing C++ projects. Our approach uses dependency analysis and clustering to organize elements of an existing project into modules, without domain‐specific information. Based on our study of two medium‐size open‐source projects from disjoint domains and vastly distinct architecture, upgrading existing software systems to the new Modules feature is limited by the existing design of the project's architecture. To fully facilitate the use of Modules in a project, it is likely that both project‐internal and user‐facing interfaces must be changed.
computer science, software engineering
What problem does this paper attempt to address?