Round Trip Engineering

SENG 422 Lab 3
In the last lab we did a brief overview of Design
Patterns and of Linux Screen.
For this lab search the internet and find a design
pattern you can replicate by using a UML
diagram, any of your choice.
You will then use your diagram to generate code
using MagicDraw UML code generation.
SENG 422 Lab 3
Round Trip Engineering
Round Trip Engineering: A way of attempting to synchronize
source code, models and other information as development
progress. When designing a system it's inevitable that we will
want to alter our design and our code. If we use a set of Round
Trip Engineering tools we can keep them both synchronized,
allow us to update the model and move those changes into
generated code and conversely if we change the code, we will
see these changes reflected in the model.
Round Trip Engineering using
MagicDraw UML
1. Open MagicDraw UML
2. Create a small class diagram of your chosen pattern.
3. Right click on “Code Engineering Sets”
4. Create a new set
5. Right click your new set
6. Click “Add Data from Model” or just Drag and Drop
from the browser
7. Select the classes you wish to auto-generate
8. Expand the new File View set and see your
generated code.
Round Trip Engineering using
MagicDraw UML cont
9. Right click on your Engineered code set and
click “Generate”.
10. Set a working directory output for all
generated files.
11. Open your code to see the output from the
generation
Reverse Engineering from Code
MagicDraw UML allows us to sync the model
and the code. We can do that by performing
the following:
1. When auto generating code as above select
the following option:
Reverse Engineering from Code
cont
You can now make changes to your source files.
When you auto-generate your code your
changes will be imported into your model, you
will see them reflected.
Lab Assignment
Send me your source UML diagram and your
source code zipped. As proof you went through
the exercise.
* If you run into difficulties consult the following:
http://www.magicdraw.com/files/viewlets/MD_125
_viewlets_CodeGeneration_viewlet_swf.html