Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C / C++ packages to understand code for refactoring

I am about to starting to work on a project which involves refactoring and modifying existing code which is in c & c++. The code is a bloated one and is in huge volume. Of course since the code needs to be modified, an understanding of the code has to be developed and in a very short span of time since we have some pretty time pressed project schedule. Can anyone please suggest any open source tools which will help in achieving the above. In short what I am looking for is tool which can:

  1. Reverse engineering tools which will help understand the design.
  2. Sequence generator tools which will help draw sequences at run time(Most probably we will be able to run the code, but not in the initial stages at least) or through code examination.
  3. Good code browsing tools to study the existing code base.
  4. Suitable tool which can auto refactor code with minimal efforts.

Please do tell me about any experiences,preferences or favorites worth looking out for.

[EDIT] Came up with a list of tools to help in above. Here's the list:

  1. Graphviz & doxygen
    Generate UML class diagrams from existing code base

  2. UMLStudio
    Creating an object model for your OO legacy code is the best approach to analysing, understanding and maintaining it. UMLStudio can automatically convert C++, Java, CORBA IDL, PHP 5, and Ada 95 code into OOA&D notation faster than any other CASE tool.

  3. CodeDrawer for C++
    The CodeDrawer converts source code to visual based diagrams. Class, struct, and any elements of source code can be shown diagrams. It also shows the logics of a function and a method. The CodeDrawer helps understand source code of your project

  4. Imagix
    Reverse engineering and visualization of source code lead to improved program comprehension. Speeds: Learning Unfamiliar Code Change Impact Analysis Integrating Open Source Code Code Reuse Software Maintenance

  5. AgileJ AgileJ StructureViews is a plug-in for the Eclipse Java IDE which generates highly customisable UML class diagrams on an industrial scale, ideal for agile development or exploration of any existing Java codebase.

  6. MaintainJ If you can run the code base then MaintainJ generates UML sequence and class diagrams at runtime when you run a particular use case.

  7. Java Reverse Engineering Tool Generates class diagrams and relations between classes from Java source code.

  8. Source Insight Great source browsing software

One more, Thanks to Steve Townsend
Klocwork

like image 431
Alok Save Avatar asked Sep 23 '10 09:09

Alok Save


1 Answers

The code is a bloated one and is in huge volume. Ofcourse since the code needs to be modified an understanding of the code has to be developed and in a very short span of time since we have some pretty time pressed project schedule.

Then you have a management problem : if you already know you have little time to UNDERSTAND a lot of code, you're doomed. To understand this code, you'll have to make it run and go through it and it will take time. Tools will just give you a big map of things but will not show you the real path.

Suitable tool which can auto refactor code with minimal efforts.

You're living in wonderland.

There are tools that gives you the structural architecture of you application, but that will not really help without going through each module one by one and read the code. First the code that use the modules, then the code inside the modules.

The fact that it's C and C++ makes it even harder to define the time that it will take you as it's also relative to the knowledge you have of those languages and the level of knowledge of the people who wrote the app.

like image 169
Klaim Avatar answered Nov 15 '22 18:11

Klaim