Sparx Enterprise Architect conversion (from source to UML)
Asked Answered
L

3

9

I need to make a UML class diagram for a project. I used Sparx Enterprise Architect in the past to generate source code from a diagram so I'm using that.

The project is complete so all of the code is done and I don't really want to write all the classes/functions manually, so I was trying to generate the diagram from the source code but can't seem to find a way to do it. I searched online and on their website but nothing.

Any help appreciated.

Latonia answered 29/5, 2010 at 17:27 Comment(3)
What value do you think you are adding by doing this? I'd stick to a package diagram showing responsibilities in modules, and use something like doxygen for documenting the project as built.Chirr
I just did it because I had to (and no one told me beforehand). I always document projects with doxygen though.Latonia
I am not sure that makes much sense; Doxygen can generated UML style class diagrams.Caplin
A
6

It's called "reverse engineering" to import the code into the model. After it's in the model you can make diagrams.

Aalto answered 29/5, 2010 at 17:33 Comment(4)
The reverse engineering concept is nice but the reality is different !! If you look in detail at the model then you will realize that less of 50% of the project has been really mapped to the model. I tried java reverse but other reverses could be better.Christyna
Even worth because because if you generate code from your model and then recreate a model from your code you have lost 70% of the initial class diagram model !! The problem is that there no traceability between model and code generation. Only EclipseUML Omondo allows this feature because they have a merge option.Christyna
@roko-sifredi -- Some years ago I found that Sparx Enterprise Architect worked well for round-trip engineering, using C#.Aalto
It's ok, thanks. It didn't work that well but I didn't expect it to. I just didn't want to write all the classes/functions again so it worked fine. I just added the connections manually and cleaned up the extra stuff that came up.Latonia
P
10

For Version 8 of EA Corporate Edition. Open or create a project. Create empty class diagram. Menu selection: Project -> Source Code Engineering -> Import Files Directory dialogue box opens for you to select files.

I have 'reverse engineered' many C++ projects, large and small. You WILL spend significant time on cleaning up. It will depend on the quality of the project, its structure and code.

Then you can generate a documentation report on it (Project->Documentation) which I have found very useful, the HTML report, to navigate the code.

Portemonnaie answered 30/5, 2010 at 10:46 Comment(0)
A
6

It's called "reverse engineering" to import the code into the model. After it's in the model you can make diagrams.

Aalto answered 29/5, 2010 at 17:33 Comment(4)
The reverse engineering concept is nice but the reality is different !! If you look in detail at the model then you will realize that less of 50% of the project has been really mapped to the model. I tried java reverse but other reverses could be better.Christyna
Even worth because because if you generate code from your model and then recreate a model from your code you have lost 70% of the initial class diagram model !! The problem is that there no traceability between model and code generation. Only EclipseUML Omondo allows this feature because they have a merge option.Christyna
@roko-sifredi -- Some years ago I found that Sparx Enterprise Architect worked well for round-trip engineering, using C#.Aalto
It's ok, thanks. It didn't work that well but I didn't expect it to. I just didn't want to write all the classes/functions again so it worked fine. I just added the connections manually and cleaned up the extra stuff that came up.Latonia
A
1

for that you should first use Reverse Engineering options but as some other users pointed out, this is not a strenght from EA. i tried in the past (version 7.3 I think) to do it with C, Python and Java Projects and the results were not always satisfactory.

I dont know which programming language is your code written in, but as for C, if you use preprocessor instructions, you will have lot of issues and incompatibilities in the result.

Audieaudience answered 1/6, 2011 at 17:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.