Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - pmichaud

Pages: [1]
1
Suggestions and Requests / Re: Multi Language Code Generation
« on: February 27, 2006, 02:19:58 pm »
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.

2
Suggestions and Requests / Re: Multi Language Code Generation
« on: February 27, 2006, 10:23:26 am »
By the way,  even though EA has problems with this,  it still did better than Rational does for their transforms.


Paul Michaud

3
Suggestions and Requests / Re: Multi Language Code Generation
« on: February 27, 2006, 10:15:22 am »
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

4
Suggestions and Requests / Re: Multi Language Code Generation
« on: February 27, 2006, 07:08:36 am »
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

5
Suggestions and Requests / Multi Language Code Generation
« 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

6
Hi Simon,
I just looked again,  and you are right.  I think the issue with packages being named for classes is now fixed.  the issue seems to be only with package structure itself.


Paul

7
Hi Simon,

FYI, 788 did not fix the tranformation problem which was resulting in the packages being screwed up and some packages being named for classes,  etc.


Paul

8
I have checked the intermediary file and it is wrong there.

So does it look like the fix will deal with this?


As for the DDL, is there anything I can get that someone needs testing, etc that will bring in the parent class attribute.  I am willing to be a guinea pig for this, or even do some code mods myself if someone can point me in the right direction.

I have limited time, but since this is going to impact me on over 400 classes it is worth some effort on my part.


Right now my alternative is to generate the stuff and then hand modify the resulting DDL files.


Thanks


Paul

9
Will do re the template.


Yeah I figured that the xml, was simply a dump of the database structure for this.  It is clear that the app is not using the file directly.


Paul

10
Thanks Thomas,

Actually I had spent a fair bit of time playing with this stuff yesterday and here is what I found.

1) I actually tried modifying the DDL_DataTypes.xml file.  None of the changes I made appeared to have any effect on the generated tables or in the way the DDL transform generated stuff.

2) I was actually able to get somewhat proper DDL (for things one would expect the system to understand, not nested classes, etc)  to be generated.

Caveat:  I still can't seem to get it to include attributes from parent classes in the table schema.  Anyone have any luck with this.

You will always have to go back and manually create the Primary Keys and modify columns which associate with other complex class types.

To get it to work I did the following:


1) I created a new language in the Code Datatypes and called it in my case MDCDatabase
1.1) I specified the database types I would be using for my columns and mapped them to the generic type names used in the code types not the database types.  for example String, Double, Ulong, etc.  instead of varchar,float, bigint.

2) I made a new transformation type which I again called MDC_DDL.  I patterned it on the current DDL tranform with some changes to gegt the type conversion better.

I have included it here incase anyone else finds this useful.

FILE:
Package
{
 name="MDC_DDL"
 namespaceroot="true"
%list="Namespace" @separator="\n\n" @indent="  "%
}

NAMESPACE:
%list="Namespace" @separator="\n\n"%
%list="Class" @separator="\n\n"%


CLASS:
Table
{
 %TRANSFORM_REFERENCE("Table")%
 %TRANSFORM_CURRENT("language")%
 language=%qt%%MDCDatabase%%qt%

%list="Attribute" @separator="\n" @indent="  "%
 PrimaryKey
 {
   Column
   {
     name=%qt%%CONVERT_NAME(className, "Pascal Case","Pascal Case")%ID%qt%
     type=%qt%%CONVERT_TYPE("MDCDatabase","ULong")%%qt%
   }
 }
}
%list="Connector" @separator="\n"%


ATTRIBUTE:
Column
{
 name=%qt%%attName%%qt%
 type=%qt%%CONVERT_TYPE("MDCDatabase",attType)%%qt%
}


I removed any Foreign Key stuff as I personally don't like using them.

Anyhow this works better.  Note the language setting are set to point to the new language I defined, which maps the UML Code Types to the database types I want them to be.

This way I can get some of the database stuff to come out right.


Now if I could just figure out how to get the attributes of the parent class included in the child classes corresponding table,  I think this would be about the best I can do with this.

Hope this is of help to others.

Paul




11
I haven't noticed mention of these two issues with the transformations in any of the threads so thought I would bring them up to see if anyone else has seen this or found a fix.


1) When generating PSM for a project (in my case both C# and C++ at the same time) I have noticed that when I try and do my whole project the packages get screwed up and in some cases I have seen packages get named according to a class, etc.  Now in the case I am playing with the project is not too big yet.  Only about 120 classes (most of which are empty as I just started dropping them in) with about 35 packages nested to 6 layers deep.  This is a real pain as I have to go and completely reorder stuff and even rename some things.  This looks like an issue with the parser.


2) I have noted that the Common Types are different for Code Types Versus Database Types.  As such, creating a single UML model and then generating Code as DDL results in at best one being generated correctly but guarentees that it is not possible to get both correct.  Now I have tried defining new language data types and even a new fake database type where I mapped the Common UML Code Types to the database types.  It still generates the wrong DLL when the existing DLL transform is used.  I suspect it has to do with the language type specified in the DDL transform being set to genOptDefaultDatabase for which I can find no definition.  Also I have no idea what to change this to in order to get a different behaviour.

Any insight, help or corrected transformation code, greatly appreciated as this is going to be a pain once this project gets bigger.


Paul Michaud

Pages: [1]