Book a Demo

Author Topic: Language Datatypes, Common Type, CONVERT_TYPE  (Read 2656 times)

olafk

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Language Datatypes, Common Type, CONVERT_TYPE
« on: August 18, 2005, 10:05:20 pm »
When specifying new a language / product type --- and specifying its datatypes, I have a choice to add the "Common Type" as part of the datatype's specification. For example, for the Java language, and the pre-given 'byte' datatype, we find a Common Type of 'Byte'. Here's what the help page says:
Quote
The common type is the generic name of the datatype , for example the Java boolean datatype has a common datatype Boolean.


But, sorry, I don't quite get it. In Java, both are legal datatypes. Neither is any more common than the other. Then I thought, well, we might be talking about some common, "UML" datatypes --- common to all (implementation) languages; i.e. a platform independent type (see also below). But then amongst the C++ types I find a common type of "Uint" for the C++ type 'unsigned int' (and I am tempted to think that Uint can hardly by a generic, UML datatype).

Where does the tool list such common types? Where else can I find them? And, then, should I not be mapping common types to Java types; i.e. choose a common type, and specify to what I'd like that mapped to (rather than specifying the Java type and - optionally - entering a free-text common type)?

Lastly, let me talk about the CONVERT_TYPE model transform macro; here's the help file:
Quote

 CONVERT_NAME(<destinationLanguage>, <originalType>)  
  Will convert <originalType>, to the corresponding type in <destinationLanguage> using the datatypes and common types defined in the model.  
  Where:  
  ยท <originalType> is assumed to be a platform independent common type.  


This seems clear enough - and point to the interpretation that a common type is language-independent etc.; except...

When modeling (say) a class, one specifies a "language" for that class (why specify a language in a PIM?). Choosing <none> as the language gives me no primitive datatypes at all --- can't even specify an integer attribute (the only type choices are other classes).

Choosing a class language of (say) Java, gives me the complete set of Java language datatypes as expected. Of course, I am then modeling a PIM using Java datatypes. Further, what does the CONVERT_TYPE macro achieve? Converting my Java type to the specified free-text "common type", then converting from the common type to the respective target language type?

Could somebody please shed some light on this? Any comments greatly appreciated...

cheers,
olaf.

cgaviao

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Language Datatypes, Common Type, CONVERT_TYPE
« Reply #1 on: June 08, 2006, 07:25:27 pm »
I really would like to hear about this too...

olafk

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
    • View Profile
Re: Language Datatypes, Common Type, CONVERT_TYPE
« Reply #2 on: June 08, 2006, 09:25:44 pm »
Eventually, when the forum posted nothing, I filed a support request and here's what Simon replied (@ Sept, 9 2005)
Quote
You are correct that the common type is intended to correspond to a generic UML datatype.  However, as you correctly note, there is no validation of these types, and some of the ones included in EA don't seem to fit that description.  Currently, these common types are only accessible to users through the datatypes dialog, and only used in the CONVERT_TYPE macro.
 
With the language set to <none>, it is true that you don't get any primitive types listed at all.  However, you are able to enter the types in free text.  The CONVERT_TYPE macro only becomes useful when you are transforming your model to two different languages.  In this situation, it allows you to use correct datatypes for both languages.  Because language datatypes do not have a 1 to 1 mapping with common types, you may also need to modify the built in datatypes.  Either by modifying the common type, or introducing a duplicate type, and giving it a different common type.
 
We recognise that there are some problems to the way types are currently handled in EA, and have plans to improve many of them.
No further comment since... maybe you could persue?

cheers,
-olaf