English

Software refactoring and rewriting: from the perspective of code transformations

Software Engineering 2023-08-15 v1

Abstract

To refactor already working code while keeping reliability, compatibility and perhaps security, we can borrow ideas from micropass/nanopass compilers. By treating the procedure of software refactoring as composing code transformations, and compressing repetitive transformations with automation tools, we can often obtain representations of refactoring processes short enough that their correctness can be analysed manually. Unlike in compilers, in refactoring we usually only need to consider the codebase in question, so regular text processing can be extensively used, fully exploiting patterns only present in the codebase. Aside from the direct application of code transformations from compilers, many other kinds of equivalence properties may also be exploited. In this paper, two refactoring projects are given as the main examples, where 10-100 times simplification has been achieved with the application of a few kinds of useful transformations.

Keywords

Cite

@article{arxiv.2308.06615,
  title  = {Software refactoring and rewriting: from the perspective of code transformations},
  author = {Yu Liu},
  journal= {arXiv preprint arXiv:2308.06615},
  year   = {2023}
}

Comments

10 pages, 4 figures

R2 v1 2026-06-28T11:54:22.800Z