Naming Rules
While working with the web modeler, you mainly create elements and modules. Every element and every module has to be given a name. Naming a module is easy since there are no rules except for the maximum length of a module name: 128 characters. Code generators normally don’t make use of modules and thus, a module name doesn’t have an effect on what is going to be generated.
Element Names¶
For element names this is different. They heavily affect what is getting written by code generators. This ranges from file names to names of identifiers of programming languages (names of methods, functions, fields, parameters, …). In an ideal world, code generators normalize the element names prior to determining what is going to be generated. Normalization typically means the removal or replacment of whitespaces and special characters.
Since we do not live in an ideal world, it can be advantageous to avoid spaces and special characters in element names. In doing so you get another benefit: It becomes easier to relate fragments of generated code to model elements. The web modeler doesn’t prevent you from using spaces and special characters, though. If you prefer element names that are closer to what you, as a human being, would write, read or talk about: You can do it.
Handling of Names in Generators
Check your generator documentation in regards to the handling of model element names before you start modeling. This can save you the effort of having to rename lots of model elements at a later time. Knowing about how your generators handle element names, you can make an informed decision about how to name elements.
Duplicate Names¶
A user must not create two modules with the same name. The same holds true for models and generation inputs. The web modeler ensures that this rule is observed. For elements the rule is a bit different:
- A module must not include two elements with the same name and type.
- Two owned elements of the same name and type can have the same name when they are owned by different elements.
- Two non-owned elements of the same name and type that are in the same module are not allowed.
- Two non-owned elements of the same name and type that are in different modules are OK only when the two modules have a different namespace set. Find more on namespaces in the documentation for the Module Details View.