Abhinav Upadhyay
Abhinav Upadhyay

Reputation: 2585

What is the technique behind the code generation feature of UML tools

I am an engineering student, and deciding upon my final year project.

One of the many candidates is an online UML tool with code generation facilities. But I did not take compiler designing classes, so I am not much aware of the code generation techniques.

I want to know about the techniques that I should look to study in order to build something like this. If these techniques are as complicated as writing a compiler, then perhaps I will have to abandon this idea.

Upvotes: 1

Views: 478

Answers (5)

Rebol Tutorial
Rebol Tutorial

Reputation: 2754

You can just find that here: http://yuml.me and http://askuml.com

Upvotes: 0

UML GURU
UML GURU

Reputation: 1462

The creation of an UML tool is a long term project. You need many to acquire different expertises which can not be known by just one member of the team. Your academic project is too ambitious.

An easy project which has never been done is to generate code from an activity or state diagram. You should not try to recreate the graphical editor because this is very very complex but only to take the xmi export and generate code from it using a xml parser. This would be a good 6 months project for your thesis :-)

Upvotes: 2

Robert Harvey
Robert Harvey

Reputation: 180858

Compilation is really the opposite of the kind of code generation you are describing, so I don't think you need to know how to write a compiler.

Code generation can be as simple as combining text strings or using templates, or as complex as using Reflection.Emit to create classes at runtime.

I would start with this Wikipedia article.

Upvotes: 3

Jerry Coffin
Jerry Coffin

Reputation: 490348

Most UML tools generate source code. The generation is normally quite a bit simpler than a compiler as well. For example, a class diagram will have a collection of data structures representing classes and links between those classes (inheritance). To generate output, you walk through the class objects, and for each you "print" out a representation of that object in the syntax of the target language.

Upvotes: 1

Adam Shiemke
Adam Shiemke

Reputation: 3742

I'm not sure exactly what capabilities your code generation will require, but the UML tools that I have used are not very sophisticated in their code generation.

Tools that I have used simply create files and drop your function names into them with arguments derived from the inputs. This would not require any understanding of compilers. Most of the difficulty would be in the user interface and how you store the data to make code generation easy.

Upvotes: 0

Related Questions