views:

2728

answers:

10

Does anybody know a fully featured refactoring tool for C++ that works reliably with large code bases (some 100.000 lines)?

I tried whatever i can find again and again over the last years: SlickEdit, Eclipse CDT. They all were not at all usable.

SUMMARY: I took time and evaluated "Visual Assist X" as well as "Refactor for C++". Both have some impressing features, but both as well are far from perfect. Extracting a large block of code usually is not done satisfying without manual modifications - and therefore does not pay off.

"Visual Assist X" has nice features such as much more complete autocompletition etc. But it leads to so much flickering and slows down much at certain points.

By my opinion therefore the answer is: "No, there is no production ready refactoring tool for C++"

+26  A: 

Visual Assist and Visual Studio make dealing with large codebases much easier. Visual assist is good at tracking down how a class or member is used and is more effective at renaming it without false positives than search and replace.

Tom Leys
+8  A: 

I find Visual Assist X with Visual Studio very useful but it's commercial software by the way.

Another great choice is Refactor for C++.

m3rLinEz
+1  A: 

If you are using Visual C++ (Express Edition is free), you can use Visual Assist from www.wholetomato.com (link to the C++ refactoring features).

It has a 30 day trial period and we have found it to be faster and more feature-full that the built-in intellisense in the Visual C++ product itself.

JBRWilkinson
I didn't think you could use plugins with the express edition
Yacoby
I've certainly tried to install VA with VS C++ express in the past and it didn't work.
quamrana
+10  A: 

Mozilla has their own refactoring tool named Pork (Wiki, Developer Wiki). Here is the blog of the developer behind Pork. From what I've read Pork was successfully used in refactorings at Mozilla.

Pork should help if you come from *nix land, for Visual Studio I too recommend Visual Assist.

Cristian Adam
+1  A: 

Currently I can't recommend any refactoring tool for C++, certainly not for large code bases of 100k lines and above. I've be hoping this will change, like the OP, and I hope one day there will be something. I fear that the language itself might have to change significantly before we see any really good tools.

btw, has SlickEdit dropped its refactoring features?

quamrana
A: 

If your looking to reengineer your codebase: MOOSE. But that's a large collection of analysis and reengineering tools, not an editor.

Stephan Eggermont
+2  A: 

If you're using emacs, try Xrefactory . It supports method extraction, renaming of classes/functions/variables and insert/delete/move parameters.It also has very good/fast code completion engine.

barism
+2  A: 

The DMS software rengineering toolkit does this I think. It is a code transformation engine, designed for large scale and handles C++. Have no idea how elegant the output is though.

Ira Baxter
A: 

Our DMS Software Reengineering Toolkit is a transformation engine designed to carry out complex transforms over large bodies of code, including C++. It has been used to make reliable changes on systems of millions of lines of code. It operates by using compiler-accurate langauges analyzers and transformers.

It has a full C++ parser with name and type resolution, builds ASTs of code, can apply procedural or source-to-source transformations (with C++ surface syntax) to revise those trees, and regenerate compilable output with comments preserved.

It has been used on large scale reengineering projects, including C++ component re-architecting, and 100% fully automated translations between langauges. You can read about this at the website.

DMS is also used to build arbitrary source analysis tools. Examples include clone detection, test coverage, smart difference (comparision of source code structures and abstract editing operations rather than lines with simple insert and delete), etc.

What it is not (presently) is an interactive refactoring tool. We believe that to do most refactorings well, you need deep control and data fow analyses. DMS has generic machinery to support this, and that machinery is implemented for C, COBOL and Java at this point, with C++ being next in line. This is a tough job. You won't see a lot of serious C++ refactoring tools from anybody until this kind of problem has been solved well. First you need a full C++ parser :-}

Ira Baxter
+1  A: 

CppDepend can help to discover the existing code base before refactoring, it provides a CQL langugae to request code base like SQL.

CppDepend provides also some useful views like dependency graph, DSM and metric view.

Issam