Search code examples
umlclass-diagramvisual-paradigm

Synchronization between code and model in Visual Paradigm


I create a class diagram and then generate their code by Visual Paradigm.

I have inserted a lot of code into generated classes and now I need to update the model. but I would like to perform updating through Visual Paradigm for easiness.

if I update my model and then generate classes and replace them on current classes I will lose my codes.

how could I insert my code in the model to keep and maintain them after generating classes code in the model?

I could update classes and then update the model by them, but updating in the model is more simple and I want to update my model first and then update my classes based on new model and keep classes implementation codes as well.

solved :

in roundtrip, changes will be merged(not overwrites) and codes in the class file will be maintained. so I should update the model and start roundtrip on the existing file to merge new model element in the existing model element and codes.


Solution

  • You want to update your model to reflect the changes done in the sources, that means update classes already defined in your model, add new classes in sources not yet defined in your model, delete classes existing in the model but not anymore present in the sources.

    All of that is a "roundtrip" (from sources), which must not be confused with the "reverse" (from sources) which does not update elements in the model but creates elements without considering the fact they already exist or not in the model.

    It seems you can do that in Visual Paradigm (even the way to do seems strange for me because starting by a reverse) :

    I encourage you to learn how to do using a new dedicated model / sources just made for that purpose, to not take the risk to destruct your existing model/sources by error