Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [] Reverse source code to a class diagram but maintain previous layout


I think, now, I got a hang of it.

The existing reverse code is more messy than it needs to be IMHO. I am rewriting the code using a visitor pattern, similar to what has been done for the code generator. I tried refactoring but it seems to be harder than starting from scratch. However, I am a bit concerned that I might be missing something, and this something is what made the existing code messy.

Is the rewrite acceptable?

In the future I think it will be a good idea to integrate the code generator and the reverser. One advantage would be: updates to one would be easier to reflect on the other.

Awesome would be to declare (e.g., using a model) the "correspondence" between the two models and to automatically generate the code generator / reverser based on that. But then, this is not an easy problem. I am checking some papers on this.

My current test plan is:
(Having one or more test models.)
- Generate the code using the test models
- Reverse the generated code into a reverse model
- The reverse model should be equivalent (not necessarily equal, e.g., IDs may be different) to the test model.

The first stage of development could end when code coverage is 100% for the code generator and the reverser. This would try to show that all the features of the code generator are supported by the reverser (at least).

In a second stage, we would add to the reverser support for code which doesn't follow the code generator patterns but which can be found in the wild. The test plan could be: pick several C/C++ applications or libraries; reverse; code generate; compile and run their test suites; if all is ok I think we are good to go.

NOTE: I am currently focused on reverse but not roundtrip. My plan is to rewrite the reverse first and then tackle roundtrip. I hope that with a new reverse architecture, roundtrip will be "easier" and the code can be kept clean.

Seen this, can you see this being integrated?
Is there something missing?

I also would like to know: How strict is the Cpp profile? Can it be changed? (IMHO, there are some things that could be added or changed.)

Thanks in advance.

Happy new year!

Best regards,
Adriano Carvalho

On Wed, Dec 12, 2018 at 7:10 AM Adriano Carvalho <adrian.dmc@xxxxxxxxx> wrote:
Hi Ansgar,

Thank you very much for the answer. I will check it out and then I'll give some feedback.

Best regards.
Adriano Carvalho

Na(o) quarta, 12/12/2018, 06:47, Ansgar Radermacher <ansgar.radermacher@xxxxxx> escreveu:

Hi Adriano,

the reverse mechanism for Java is incremental. In case of C++, your guess is right, the code is there but currently disabled, as it does not work in some cases. Unfortunately, we had no time to work on it since the video was done. Besides the functional aspects, the tool usage between C++ and Java should be harmonized.

If you have a look at the plugin.xml of plugin oepd.languages.cpp.reverse.ui (see below), you'll see that commands, menu-entries and handlers related to "reverseToExistingUmlModelMerge" have been commented out. You can re-enable these and we would appreciate to get some feedback on it. In order to do so, you need to import the plugin from the papyrus SW designer git [1], remove the comments in the plugin.xml and execute/debug a second Eclipse instance.

Best regards




file plugin.xml (org.eclipse.papyrus.designer.languages.cpp.reverse.ui):


            name="Reverse to existing UML model (Merge)">



On 08/12/2018 17:47, Adriano Carvalho wrote:

Sorry for the long email.

I want to add support for the following use case to eclipse.

- Suppose you are working on a Java or C++ project.
- You are on the source code editor, you zoom out and eclipse shows you a UML class diagram view of the source code in the current file.
- You zoom out again and eclipse shows you a UML class diagram of the source code in the current folder. And so on...
(Zoom in would take you back where you were before zoom out.)

While on the UML class diagram views you rearrange the elements, show/hide relationships, add comments, etc., to facilitate understanding and increase the clarity of the source code and its architecture.

For this to work we need the following functionalities:
- Reverse source code to a class diagram. Check.
- Update layout of the elements in the class diagram. Check.
- Update the source code. Check.
- Reverse source code to a class diagram but maintain previous layout. ???

According to the video in the following link, the last functionality was present in the past but seems to no longer be supported. I tried the nightly build and also couldn't find the necessary option.

My question then is: What is the status of this functionality? Is it there but not enabled?

If needed I would like to contribute to this functionality. I would just need some pointers to start.

Best regards.
Adriano Carvalho

_______________________________________________ mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
_______________________________________________ mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Adriano Carvalho

Back to the top