Welcome to DFRefactor
DFRefactor is a free, open-source tool for automated refactoring of DataFlex source code. It applies behavior-preserving transformations that bring legacy code in line with modern DataFlex syntax. When you move a workspace to a newer DataFlex version, it also converts the code that the new version no longer accepts.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
— Martin Fowler, Refactoring: Improving the Design of Existing Code (2nd edition, 2019)
DFRefactor is inspired by the discipline of refactoring as formalized in Martin Fowler's seminal work. See What Is Refactoring? for background.
Where to start
- Overview — what the program does and does not do. Start here.
- How to use the Program — a complete session, step by step, in the order that the program expects.
- Refactoring Functions — what each individual function changes, with before-and-after examples.
In short: open a workspace and choose the DataFlex version you are moving to. Then use either the Guided route or the Manual route. In the Guided route, one Check compiles and scans the workspace and shows a list of findings, sorted by priority, for you to approve. In the Manual route, you select the folders and the functions yourself. No file is changed until you approve, and every changed file is backed up first.
Components
DFRefactor is the program you work with. The other programs are helper programs, and most of them are started automatically when they are needed:
|
Program |
Audience |
Purpose |
|
DFRefactor |
All users |
The refactoring application. Everything in this help refers to it. |
|
TestBench |
Writing your own functions |
A tool for developing and testing your own refactoring functions. It runs your function on a test file and shows the code before and after the change side by side. It also contains the JSON Export/Import feature, which you use to send a function you have written to RDC Tools, so that it can be included in the standard function library. Only needed if you add functions to UserDefinedRefactorFunctions.pkg. |
|
UnitTests |
Optional |
Runs the unit tests for DFRefactor's function library. It is included so that you can run the tests yourself. It is not needed for refactoring. The DFUnit framework was originally developed by Ola Eldøy, enhanced by Bram NijenKamp, and adapted for this project. |
|
DUFUpdateProgram |
Never run directly |
Updates DFRefactor's database. DFRefactor starts it automatically when its tables need to be updated. |
Project and contact
Source code, issues and discussions: https://github.com/NilsSve/DfRefactor
- Bug reports: Issues
- Questions and suggestions: Discussions
- Commercial services (custom refactoring functions, full legacy-code migrations): see Feedback