Sparx Systems Forum
Enterprise Architect => Suggestions and Requests => Topic started by: pmichaud on February 27, 2006, 06:49:52 am
-
I do a lot of projects which have C# for GUI and C++ for server side stuff (due to performance requirements). Often I need the same classes to be available to both languages.
Currently, there is no easy way for me to have this with EA, without painstakingly creating the classes in both languages by hand the hard way.
What I would like to be able to do is to have 2 features added to EA which would simplify this and many other things as well.
1) I would like to be able to multi-select a UML element (usually a class or a package in my case) and copy it with all of its class attributes (or child elements, etc in the case of a package) to a new package/view. I would like this to be a distinct copy and not an instance of the other class.
2) I would like to be able to multi-select packages/elements and change the language property in bulk for all of them simultaneously (with the change to a package affecting all child elements in a cascading fashion).
I think these would be useful features for many other uses as well and shouldn't be too hard to implement.
Thanks
Paul Michaud
-
In addition,
I am not sure what purposae there is in defining the package to have a language association when the system doesn't seem to use it.
It would be better if the langauage setting for a package overroad the default langauge for code generation set in the project.
The default should be used for the initial setting on package creation or when package languages are not set yet.
Otherwise in large mixed language development it is easy to accidently spec a C++ class in a C# package for example.
Also when doing this in one EA project which has both C# and C++ in the same project. If I have ClassA defined in both languages within the same project and I specifiy an attribute of Type ClassA in a C# class for instance and go to pick the type in the drop down list, I don't know if it is associating with the C++ instance or the C# instance.
It would be best if a more complete qualifier could be specified in the drop down list somehow. It may be best to have this display as an optional setting as many people won't need this feature.
Paul Michaud
-
Why don't you use MDA? You can create two different PSM from your PIM using the transformation.
-
Thanks for the suggestion. Although I have been using EA since version 1, I have not tried this feature.
I tested it just now transforming my C++ into C# and DLL just for kicks.
Although the transform to C# was not bad, it does not get the types correct. for example:
C++ string stayed as string instead of String, etc.
Not surprising really.
The problem there I suspect is that my UML is C++ specific and not Platform Independant.
Now if I make a PIM the problem is that there is no C++ transform implemented currently and I don't know how to create one.
Also on the DLL, my model was way to complex for it and it completely faked the system out. It basically made tables with column type equal to the class attribute types. so booleans stayed as bool and not bit. If the attribute was of type ClassA then the column was of Type ClassA and so on.
It does look like if I create all of my stuff a C++ specific UML then perform the transform to C#, I could then run a global search and replace on the types (always somewhat risky) and then revewrse it back to get proper C#. This would save some time (Current project will be over 400 classes of base types alone and I don't want to eneter them 3 times (C++, C# and DDL).
Still not optimal, but its better than the alternative.
Thanks
Paul Michaud
-
By the way, even though EA has problems with this, it still did better than Rational does for their transforms.
Paul Michaud
-
Hi Paul,
Currently the datatype mapping is the weakest part of the transformation process in EA.
You could get it to work for C++ to C# by making sure that all C++ types you have used are used as the Common Types you want them mapped to in C#. (See Settings | Language Datatypes) You could also do the same thing for the default databse to create those types.
If you're using a PIM make sure that for all target languages each of the types you are using in the PIM are set as the common type of a target language. A C++ transformation can be made basically by copying the C# or Java transformation.
The fact that the DDL transform creates columns of types to match a classifier in your model is a fault of the transform, which should create a foreign key out of it.
If you want to make the datatype mapping really good, the best you could do would be to create a helper addin. Then call it using EXEC_ADD_IN where CONVERT_TYPE is currently being called. This call has been discussed plenty of times in the forum, so I suggest doing a search and then asking more questions if you need to.
-
Yeah I managed to create a new C++ transform and It works for the most part.
The issue I have is with Generics (C++ Templates). I need to figure out how to get them out correctly. I am not even sure what UML notation there is for them (Can't say as I have ever seen a generic in pure UML.)
Is it even possible to do this. I am sure others must have tried.