I've been playing around with Transforms - which, in theory, should be extremely powerful.
One of the biggest issues in transformations is name control...
The Sparxians have recognised this. Here is an extract from the Help:
Different target platforms may use different naming conventions, as a result you may not want to directly copy the names of your elements directly into the transformed models. To facilitate this need EA's transformation templates provide a CONVERT_NAME function macro.
CONVERT_NAME(<originalName>, <originalFormat>, <targetFormat>)
Will convert <originalName>, which is assumed to be in <orginalFormat> to <targetFormat>.
The supported formats are:- Camel Case: New words start with a capitalised letter. The first letter of the first word is lower case.
- Pascal Case: Same as camel case but the first letter of the first word is upper case.
- Spaced: Words are separated by spaces.
- Underscored: Words are separated by underscores and assumed to be lower case.
Note: Acronyms are not supported when converting from camel case or pascal case.
Unfortunately this isn't enough control... :(
What we aren't told is that
spaced and
underscored format is
lowercase ONLY! ???
So, in the spirit of
"Do it right, do it once..." 8), I'm going to canvas suggestions on what extra degrees of control might be required by transformers, before submitting a formal defect report to Sparx.
In a previous application that I developed, I came up with a different model:
Each name had two attributes:
- Separator: Character (including NULL - for no separators)
- Case:Upper, Lower, Title(Pascal here), Camel
Thus CONVERT_NAME would become:
CONVERT_NAME(<originalName>, <originalSeparator>, <originalCase>, <targetSeparator>, <targetCase>)
This "pattern" allowed pretty generic conversions.
Can anyone suggest a required conversion that wouldn't be handled by this?
Also, we had a method that analysed a given name and returned the values of the two parameters, so you could check the original name was correctly specified. (I can provide details if interested...)
Thoughts anyone?
Cheerz,
Paolo