How to load an entire Visual c++ project into Enterprise Architect to reverse engineer it? - c++

Is there a way to load the DSW file for EA to then load the entire Visual C++ project?

AFAIK you can reverse engineer C++ code only from source code (header files) into EA.
There's also a VS AddIn available: MDG Integration for Visual Studio, but that comes at extra cost.
The best way to get around the 'spaghetti mess wiring' is to draw diagrams for the classes of your interest manually. You can use the 'Add related elements' command from the (diagram) context menu of the classes you pick, this might be helpful.
Don't expect to get into programming against a complex legacy library API just from class diagrams without further documentation, but class diagrams can be helpful though to get a bird's view of the API structure.

Related

C++/Cli libraries for visualizing non-oriented graph?

I have a project in university called "Finding loops in graph". Only problem, I have to do it on C++ windows forms.
I have made several attemps on creating at least graph visualizer, but it seems I failed to create myself the classes to visualize and store information about graph. And I need to make it quick.
I have worked only with c++/cli, but if there's any other options for c++ forms, I will be glad to learn. But it has to be only on Visual Studio.
Is there any libraries, which I can use classes to define a non-oriented graph (for start) and visualize it, let's say, on any canvas?

Create class diagram from c++ source?

Is there any free tools available for generating class diagram from c++ source files and if possible for mfc source files too.
We use doxygen with graphviz support
You could try SourceNavigator. I'm not sure what the current state of the project is, but here's a place to start.
I've had some success with Umbrello (a KDE-based app). It allows you to import code to create a model, that can then be used to generate UML diagrams.
Umbrello is probably fine for projects with a limited number of classes, and certainly requires manual intervention for tuning. I imagine doxygen/graphviz is more suitable for larger projects.

Creating a C++ Class Diagram

In Visual Studio .NET projects you can add a "Class Diagram" to the project which renders a visual representation of all namespaces, classes, methods, and properties. Is there any way to do this for Win32 (not .NET) C++ projects? Either through Visual Studio itself or with a 3rd party tool?
If you have a Visual Studio 2008 solution composed of multiple C++ projects, you can only generate one class diagram per project.
For example, if you have one application project linking to 10 library projects, you'll have to generate 11 separate class diagrams.
There are two ways to work around this, neither of which is pleasant:
Cram all the source into a single project.
Create a class diagram for one project (the application, perhaps) and then drag files from all the other projects into the class diagram.
A more thorough exploration of the capabilities of the Visual Studio class designer is given in Visual C++ Class Designer.
Given the poor support for C++ class diagrams in Visual Studio, you're probably better off going with a commercial tool if you want anything more than a simple list of what classes you have. WinTranslator from Excel Software might be worth looking at, and someone I work with uses Source Insight.
Most UML tools should be able to do that. I know that Sparx Systems Enterprise Architect does.
I've got VS2008 SP1 Professional and class diagrams are working fine for C++ WIN32 and Makefile projects.
If you're using Visual Studio, class diagrams for C++ were not correctly implemented until Visual Studio 2008.
Class designer is not meant for C++, even in VS 2008. You will be better off with some more specialized tool. It works for simple projects which don't heavily use templates. Also, get modeling power toys from codeplex.
Try doing partial specializations and watch how it crams everything into a single shape.
A cheap way would be to document your source with Doxygen and let this tool create the class diagrams for you.
If your project is a c++ based project then you have to drawn class diagram of c++ first,If your project contain 'n' number of sub-projects then you have to drawn 'n+1' number of class diagram.
Basically a class diagram contains
class variables.
class functions.
Relation between classes.
You should place all the properties which are required for a class inside a class diagram. It looks like a table (graphical structure) having 3 rows type box.
Row 1. class name(If it is an Object diagram it should and must under lined).
Row 2. Variable list(One variable in one line).
Row 3. Function list(One function in one line)
You have to make the Relation between one class to another class.

Internal format of Visual Studio .ncb files

I have decided that I really need to get some flowcharts for reverse engineering some code I have inherited. I do not have the Team edition of VS so I cannot use Team's built-in capabilities with Visio. So I thought I would parse the .ncb (Parser Information) files and make charts with dot (from graphviz.org). How hard could that be? But I cannot find any documentation for the innards of that file.
I really don't want to use a commercial application to do the flowcharts. And the free addins I've seen all assume that I am using C# or VB. However, I am using C and C++.
I did try the Microsoft "Visual Studio Learning Pack" which has the "Visual Programming Flow Chart" tool. But it doesn't appear to work with C++. So close!
So, does anybody have pointers to the file format or other suggestions (keep it polite!)?
I don't think you have much chance to be able to parse the NCB files. They are in a proprietary binary format that changes and is likely to change between every single version of visual studio. From what I read somewhere, it's possible that in VS2010 the NCB is going to be discarded and the intellisense information is going to be kept in normal database using SQL Server Express.
Another option you might consider is using some other tool that analyzes your code and builds diagrams and UML charts. Doxygen does this to some extent and there is a plethora of commercial tools that do as well. I have some personal experience with Rational Rose (which might be defunct by now..) and a tool called Together. This list might be of some help
For a structural analysis in the sense of "who calls what", "who inherits/overloads where" and "who reads/writes globals" I once used DeHydra (a mozilla project) for analysis and yed (www.yworks.com) for graph display. Both are free.
Dehydra runs under linux and requires your code to pass gcc compilation. This is not a too serious obstacle, as VC can generate makefiles, which can be hand-modified for gnu make.
In my case, some patching of include files was required, but i could finally get the desired information out.
It took me 3 days to get DeHydra working, another 2 days to tweak makefile and includes and
3 more days to adapt javascript code, which inside DeHydra extracts the required information.
DeHydra + Javascript now delivers in one compiler run a graphml file containing the code structure, which can directly displayed and interactively manipulated in yed.

flowchart best practices

Could some one point to articles / books on how to create good flow chart diagrams?
BoUML-it's free!
I've used this open source tool for the last 6 months at work to create UML diagrams:
bouml.free.fr/
I've used it on both a Macbook running OS X, as well as Ubuntu Linux on a desktop, both with success. It also does codegen (although I haven't used this feature myself). If you create a diagram from within BoUML, you can right click ->Tools->HTML etc,etc., and it and actually generate the diagram -- this will create a whole tree of html, css, etc., and include a .png file which you can later choose to import into a Word-like document.
If you're new to UML, and would like to explore that route, I suggest UML Distilled by Martin Fowler as a way to quickly ramp up. I still use this as a reference when I'm putting diagrams together and I forget some syntactical detail ;) The nice thing about UML is that most programmers will understand it. If you don't want to buy a book you can, of course, Google 'UML tutorial' and get a slew of free info.
Non-UML:
You can also use open office's draw application to do some simple flow charting. It has some nice non-uml shapes, so if you're not trying to be 'strict' in the sense of conforming to UML, and just want a simple flow chart, that may be a good choice.
Check this one out:
http://drakon-editor.sourceforge.net/DRAKON.pdf
Tutorial here.
Also get a copy of Microsoft Visio.