Institute for

C++ Refactoring

Initial Status

Eclipses Java Development Tools is a powerful development environment for Java. There is also an Eclipse plug-in to develop C and C++, the CDT (C/C++ Development Tooling).
Whilst JDT provides a big amount of refactorings, CDT provides only one.

Refactoring is a way in software development to improve the quality of code without changing its functionality. In the medium term, refactoring reduces the effort for error analysis and for functional extension. Refactorings are  separated in  clearly defined steps. If these steps can be executed automatically, the working process of a software engineer becomes easier and is thus a big advantage for the product promotion of a  development environment.



The aim of the project is to implement several refactorings, which will assist a developer in their every day's work. The refactorings are supposed to  provide support for as many   C++ language features as possible. Comments and macros should correctly be processed when transforming code and be reinserted as expected when rewriting code. The existing infrastructure of Eclipse in general and CDT in special should be used and if necessary extended.



The existing code of CDT was extended to allow the introduction of the following refactorings:

  • Declare Method
  • Extract Constant
  • Extract Method
  • Extract Subclass
  • Hide Method
  • Implement Method
  • Move Field / Method
  • Separate Class

In oder to be able to convert the code from the abstract syntax tree (AST) to source code again, a code generator was implemented. So that refactorings can be tested efficiently, the test framework JUnit was extended in a way that test definitions could be read out of a file. To edit test definitions as simply as possible, a simple test editor was developed.