arrow
Return

Refactoring With Regular Expressions

delete2024-11-01
delete0
PRE
AI
D
Diomidis Spinellis *
DOI:10.1109/MS.2024.3439028delete
deleteOriginal
deleteOriginal request for help
deleteShare
deleteSave
Abstract

Abstract

En 中文
Code refactoring is an essential part of software development, because it reduces technical debt, enhances long-term code sustainability, and enables the implementation of functionality that might have been incompatible with an original design. IDEs automate many refactoring tasks, but they sometimes lack support for specific operations or languages. In such cases, regular expressions offer a powerful alternative, automating tedious tasks, reducing errors, and saving time. This article shares a practical example: extending the CScout refactoring browser to collect metrics on C preprocessor usage, which required addressing widespread cyclic dependencies. The changes were facilitated by the git-subst Git extension, which makes global text replacements using regular expressions in Git-managed files. A series of 30 git-subst invocations were automatically generated, again using regular expression replacements. While not a cure-all, regular expressions are invaluable for many refactoring tasks, making them a key skill for software developers.
Keywords:
Code refractoring
Programming
Visualization
C plus plus languages
Codes
Software development management
Integrated design
Software measurement
Linux
Licenses

Journal

IEEE Software cover
IEEE Software
IF:
3
Papers:
3.1K
Citations:
3.6K

Organization

No organization information available