Reverse-engineering the code? |
Post Reply |
Author | |
janne
MetaCase Joined: 25.Mar.2008 Points: 58 |
Post Options
Thanks(0)
Posted: 24.Jun.2008 at 09:44 |
This was asked recently several times so I decided to share it here too:
> Can I use MERL for reverse engineering (code->model)? There are many ways to import data from external sources, see a summary of the importing scenarios from: www.metacase.com/mwb/model_import.html In the picture the scenario 6 presents way how MetaEdit+ utilizes MERL for importing the data from the external source. This can be described also as a reverse engineering the code back to the model approach. MetaEdit+ repository contains an example where Java classes (*.java) and their attributes are reverse engineered to UML Class Diagram models. You can test the reverse engineering functionality in MetaEdit+ by: • Open “UML examples” project and set it as a default project • Open “Reverse engineered Java (ex 1)” model • Place some Java classes (*.java) into the MetaEdit+ 4.5\reports subfolder OR run a 'Build' generator for '2008Models' (in Digital Watch project), which will generate the Java files for Digital Watch product family • Run the “Reverse engineer Java” generator, which will create a MXM file, and import it to the default project with name “Reverse engineered Java #index number” • Open the resulted model and select a Diagram for its representation All the generator scripts are accessible for every user and they can be modified or extended further to have more complete information for the classes, e.g. having also the Operations or relationships between the classes. Edited by janne - 24.Jun.2008 at 09:50 |
|
me
Member Joined: 17.Jan.2011 Points: 7 |
Post Options
Thanks(0)
|
Hello Janne,
I've loaded the "UML examples" project but can't find the “Reverse engineered Java (ex 1)” model and the “Reverse engineer Java” generator.
Do I have a different repository-version ?
|
|
janne
MetaCase Joined: 25.Mar.2008 Points: 58 |
Post Options
Thanks(0)
|
Hi,
There shouldn't be different versions, so all demo repositories having the project 'UML examples' should have the "Reverse engineered Java (ex 1)" (Class Diagram) as well as the generator named "Reverse engineer Java" available. Could you please describe which Graphs (names?) do you have available after opening the UML Examples project? |
|
me
Member Joined: 17.Jan.2011 Points: 7 |
Post Options
Thanks(0)
|
Hello Janne,
When I've opened the project "UML examples", in the Graph Browser, there are graphs called
|
|
stevek
MetaCase Joined: 11.Mar.2008 Points: 641 |
Post Options
Thanks(0)
|
Either you have accidentally deleted the "Reverse engineered Java (ex 1)" graph, or then you have a 4.5 repository rather than 4.5 SR1. The easiest way to tell is that SR1 also added a Note object to the Watch Framework graph.
Assuming you have SR1, you can run the "Reverse engineer Java" generator on any UML Class Diagram - it doesn't use the diagram itself at all, but instead creates a new one based on the Java files in your reports directory. The generator is not intended to be a full reverse engineering tool for Java to UML (MetaEdit+ is a DSM tool not a UML tool!), but to show you the kind of thing you could build using MERL if you needed. |
|
me
Member Joined: 17.Jan.2011 Points: 7 |
Post Options
Thanks(0)
|
I have version 4.5 dev 66, I think that is still 4.5. Can I download somewhere a copy of the "Reverse engineer Java" generator. I want to create a merl-generator to reverse engineer some 'quite old' data definitions language dialects.
|
|
stevek
MetaCase Joined: 11.Mar.2008 Points: 641 |
Post Options
Thanks(0)
|
Correct: 4.5 Dev 66 = base 4.5. 4.5 Dev 92 = SR1.
You need SR1 if you want to do reverse engineering. You want to read a file into a variable and then iterate over its lines, and "do $var" was added in SR1. |
|
me
Member Joined: 17.Jan.2011 Points: 7 |
Post Options
Thanks(0)
|
That's a pitty. I bought the tool a long time ago, and re-started recently again in trying out some constructions.
In doing that and trying some forward enginering based on a graph, I wonder if it is possible to hypertext occurences of type(s) in the text-editor and use that as generated output, for instance:
... free text ... < occurence of type > ... free text ...
where you can select the occurence of type from a list. It could be usefull if a textual specification is more convenient then a graphical one, and you don't want to change text before generating if the name of an occurence of type is changed somewhere.
|
|
stevek
MetaCase Joined: 11.Mar.2008 Points: 641 |
Post Options
Thanks(0)
|
Your name here doesn't tell me much , so I'm not sure what kind of license you have and whether you'd already be eligible for the SR1 upgrade. Please contact info@metacase.com and they'll sort things out.
I guess your second question is about putting objects in text, so that the visible text updates if the object's name changes? That's certainly been something we've thought about, but it's not part of the current product. There would seem to be substantial technical challenges, in that any library for working with text will be large, and assume one character per slot. Having a slot contain a variable number of characters would break pretty much everything. There are various ways that could be tried to get around this, but my guess is that some other components that work with text would break, because they contain implicit assumptions about the internal implementation of text. |
|
Audra
Member Joined: 12.Apr.2011 Location: SUITE Points: 1 |
Post Options
Thanks(0)
|
Edited by stevek - 12.Apr.2011 at 11:48 |
|
Post Reply | |
Tweet |
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |