Is There a Working C++ Refactoring Tool

Is there a working C++ refactoring tool?

I find Visual Assist X with Visual Studio very useful. Another choice is Refactor for C++.

Good code visualization / refactoring tools for C++?

There is a KDevelop plugin for code visualization:
http://liveblue.wordpress.com/2009/08/21/gsoc-wrap-up-static-code-visualization-in-kdevelop/

Is there any safe refactoring tool for .net (or at least c#)?

To be really safe with automated refactorings is very hard.

When we first introduced refactorings in Visual C#, we asked ourselves this question: do our refactorings need to get things completely right all the time, or should we allow them to make mistakes in certain cases?

To be right all the time would require a lot of programmer effort, meaning we'd only get a few refactorings in the box. It would also make the refactorings slow, as they'd spend a lot of time in validation.

Allowing them to make mistakes would make them useless for any teams that didn't have great automated test coverage. TDD teams have good tests, but that's only one portion of the Visual Studio user base. We didn't want to make features that we had to tell people not to use!

TDD teams would catch mistakes quickly, but they would learn just as quickly not to trust our refactoring tools. They'd hesitate to use them, and seek other solutions much of the time (find-and-replace instead of Rename).

Also, as the C# team, we were in a good position to make high-fidelity refactorings. We had a unique advantage, with the C# language designers and compiler team just down the hall. We knew we should play to our strengths.

So, we decided to make fewer high-quality refactorings, instead of lots of refactorings that weren't as reliable. Today there are 6.

Visual Studio Refactorings

Looking back, I wish we had only done Rename, Extract Method, and Introduce Local Variable. Those last two are almost the same, implementation-wise. The 3 Parameter refactorings (there used to be a 7th, Promote Local Variable to Parameter, but it was cut in VS2010) were a ton of work to get right, and probably weren't worth it.

My recommendation is to do TDD, giving you a great collection of tests so you can refactor safely, whether you use a tool or do it by hand.

Any good C++ refactoring tools that could handle this scenario

Searching around for something light weight that met my needs drew a blank, and learning SED while worthwhile would have been a fair amount of work for something that did not quite solve my problem. I ended up writing my own tool to carry out the refactor needed on a seperate copy of the code base until I was happy that it was doing exactly what I needed. This involved taking the output from Visual Assists find all references option, and use it to refactor the code base. I'd post the code, but as it stands is pretty awful and would be liable to fail under a different code base. The general problem can be better stated as something like this

  • For a C++ code base, find every occurence of function fn taking parameters a,b,...n
  • Remove the occurence of fn from the source file
  • Extract the parameters as text variables
  • Add a few more variables such as instance number, source file name, etc...
  • At the point where fn was removed, write a formatted string that can include available variables
  • Append similar formatted strings to one or more external files (e.g. resource files etc...)

I'm guessing the above functionality would be easy enough to implement for someone who is already parsing the source, and will pass a link to this question to Whole Tomato as an enhancement suggestion.

Edit: For anyone interested, there's some follow up on the VA forum here.

Code refactoring tools for C, usable on GNU/Linux? FOSS preferable

I don't think that a pure console refactoring tool would be nice to use.

I use Eclipse CDT on linux to write and refactor C-Code.

There exists also Xrefactory for Emacs http://www.xref.sk/xrefactory/main.html

if a non console refactoring tool is o.k for you as well.

Good refactoring support for C++

Visual Assist X by Whole Tomato software is not free, but it's absolutely worth the money if you use Visual Studio for C++.

http://www.wholetomato.com/

Is there an automagic tool to refactor / remove some conditionals from a large C code base?

have you tried linuxes "unifdef" commandline tool? you have to tweak a bit with shell to get it recursively working



Related Topics



Leave a reply



Submit