开发者

Good code visualization / refactoring tools for C++?

开发者 https://www.devze.com 2022-12-30 13:24 出处:网络
I\'ve found myself coming across a lot of reasonably large, complicated codebases at work recently which I\'ve been asked to either review or refactor or both.This can be extremely time consuming when

I've found myself coming across a lot of reasonably large, complicated codebases at work recently which I've been asked to either review or refactor or both. This can be extremely time consuming when the code is highly concurrent, makes heavy use of templates (particularly static polymorphism) and has logic that depends on callbacks开发者_开发问答/signals/condition variables/etc.

Are there any good visualization tools for C++ period, and of those are there any that actually play well with "advanced" C++ features? Anything would probably be better than my approach now, which is basically pen+paper or stepping through the debugger. The debugger method can be good for following a particular code path, but isn't great for seeing the big picture you really need when doing serious refactoring.

EDIT: I should mention that Visual Studio plugins aren't going to be a lot of help to me, since our stuff is mostly Linux-only.


You could use Doxygen to get you started; once the easy part is done (class layout, hierarchies, ...) you need to write about the rest of the software that cannot be easily be process by tools like doxygen.

good luck.

M.


Visualising:

I'm not aware of what's going on outside of the UML world, but what is available within it does not reverse engineer modern, template based C++ at all well. At best, you will get simple class diagrams.

Refactoring:

Mozilla created the dehydra / Pork tools to analyse and refactor their C++ source to change their old-style XPCOM and memory management with better idioms. It's not tied to a visualisation tool, instead uses pattern matching and JavaScript. I haven't tried it myself, being fortunate to not having been in a position where it's required.


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


No. No. and No. You'll need to document and diagram the codebase by hand; something that should already have at least been partially done.

There's a refactoring tool, or at least claims to be, for xemacs. There's one for VS but it doesn't work to great and only knew like 5-10 refactors. The xemacs one is like $250 or something. Don't know of one for Eclipse. You'll most likely need to do your refactors by hand.


I am not aware of a refactoring tool for C++ that is even in the same league as for example the refactoring tools you can find for Java. Eclipse/CTD has some small refactorings (extract methods, make public/private/getter+setter) but thats about it.

Still Eclipse/CDT is a good tool to get an overview of a huge code base. The code navigation features (show references, show definition, show declaration, class hierarchy, etc...) are the best i have seen in a C/C++ editor.


I can't vouch for it but there is the CDT Refactoring Project.
edit: that page looks out of date. Maybe someone else can attest to the status of CDT refactoring?


The DMS Software Reengineering Toolkit is a program transformation engine parameterized by language definitions. It has a full C++ front end, and has been used to carry mass refactorings of software systems coded in C++.

See Akers, R, Baxter, I., Mehlich, M. , Ellis, B. , Luecke, K., Case Study: Re-engineering C++ Component Models Via Automatic Program Transformation, Information & Software Technology 49(3):275-291 2007 for discussion about DMS and how it was applied to C++ modules to support avionics software.

0

精彩评论

暂无评论...
验证码 换一张
取 消