Names are identifiers for variables, functions, templates, state machines and components.
In UJML, names are used to identify things so that you can reference them later in your code. These things include variables, functions, templates, state machines and components; anything that you might declare in one part of your UJML application and refer to in script or in a UJML element somewhere else in the application.
All names in UJML are XML NMTOKEN values and must be formatted as required in the XML specification. This means that it must consist only of XML NAMECHAR values. UJML adds some extra requirements by restricting which NAMECHAR values are allowed.
In practice, this means that a name in UJML must start with a letter (the characters 'a' through 'z' and 'A' through 'Z') or an underline ('_') and must consist of letters, numbers (the numbers '0' through '9') and underlines. No other characters are allowed. Some examples:
|
A_Name |
Valid |
|
_aName |
Valid |
|
aName |
Valid |
|
Name9 |
Valid |
|
A Name |
Invalid, contains a space |
|
9Name |
Invalid, starts with a number |
|
A.Name |
Invalid, contains a period |
|
A-Name |
Invalid, contains a dash |
Always name things so that they are easy to remember. This means your names should be meaningful and long names are not a bad thing. In general, you should start your names with a lowercase letter and used mixed case after that. For example, you might name a state variable that displays a red box 'redBox'. Also it is a good practice to put a lowercase 's' in front of state variable names. This would make the previous example 'sRedBox'.
For standard variables, it is a good practice to preface 'module' scoped variable names with an 'm'; for example 'mGridCellsHigh'. See Data Scoping and Sharing. For templates, it is a good practice to preface the name with a 't'; for example, 'tColorBox'. Function names should always begin with a lowercase character; for example 'getPaneWidth'. And state machine names may begin with an uppercase character; for example 'ScreenPane'.
|
Copyright (c) 2000-2007 UIEvolution, Inc. All rights reserved.
|
|
What do you think about this topic? Send feedback!
|