Introduce PImpl Refactoring for the CDT-Eclipse Plugin

Berweger, Andrea and Indermühle, Matthias and Knöpfel, Roger (2009) Introduce PImpl Refactoring for the CDT-Eclipse Plugin. Student Research Project thesis, HSR Hochschule für Technik Rapperswil.

[thumbnail of Introduce_PImpl_Refactoring_Documentation.pdf]
Introduce_PImpl_Refactoring_Documentation.pdf - Supplemental Material

Download (1MB) | Preview


CDT is a plug-in for the Eclipse IDE to write programs in C and C++. Eclipse offers refactorings, functions that restructure the code without changing its functionality. We implemented the Introduce PImpl Idom refactoring for C++. In C++ classes are usually divided in header files holding the declarations and source files holding the actual member function implementations. From the outside just public members are usable, but private members are also declared in the header file which has to be included to use the class. Introducing a new private member or modifying the signature of an existing leads to a change in the header and therefore forces all using classes to recompile. This is not a problem in a smaller project, but can have a great impact in larger projects that might take hours to recompile The PImpl Idiom describes a way to avoid that. The idea is to introduce a new implementation class within the source file that holds all member functions. The original class is reduced to public members presenting a stable interface and a private pointer to an instance of the new class (the pointer to implementation = PImpl). Those public members use the pointer to delegate all calls to the corresponding member in the implementation class. Because this class is only known within the source file, changes to it do not require classes using the original class to re-compile. But not only the re-compilation time drops, extracting the implementation in a separate class allows to use the original class as stable binary API and to hide the implementation in a library. With our refactoring all these advantages are just one click away.

Item Type: Thesis (Student Research Project)
Subjects: Technologies > Programming Languages > C++
Topics > Software
Area of Application > Data Mining
Topics > Software > Refactoring
Metatags > IFS (Institute for Software)
Divisions: Bachelor of Science FHO in Informatik > Student Research Project
Depositing User: HSR Deposit User
Thesis advisor
Sommerlad, Peter
Date Deposited: 24 Jul 2012 07:55
Last Modified: 24 Jul 2012 09:35

Actions (login required)

View Item
View Item