Code conventions are important to produce a homogeneous code.
Many reasons:
This chapter present the MeMo application coding standards.
Indentation:
Use 2 spaces for a tabulation.
In VRML, Nodes should have the following form:
In Javascript, a if-else class of statements should have the following form:
In Javascript, a switch statement should have the following form:
When you name a node with keyword "DEF" the name of the node should be
all uppercase with words separated by underscores.
It should also contain the function of the node (prefix) and the type of the node (suffix).
Example :
In VRML, when defining a node with a "DEF" keyword, you should use the following suffixes depending on the type of node:
Nodes | Suffix |
---|---|
Appearance | _APP |
FontStyle | _FS |
ImageTexture, MovieTexture | _TEX |
Layer2D | _L2D |
Material, Material2D | _MAT |
PositionInterpolator | _PI |
Rectangle | _REC |
Text | _TXT |
TimerSensor | _TIMER |
Transform, Transform2D | _TRS |
Example:
Javascript fields should use the Java notation for variables, that mean :
Example:
When the developer specializes a Prototype in another Prototype (for example :
Alert.wrl specialize Slider.wrl), the CSS file should look like the following:
The CSS Node for Alert should show that it specializes the Slider prototype : Node
Name = "Alert-Slider" and have the same elements that the Slider CSS Node.
The difference is made between Specialization (named : "Node-Spe", with first
letter of specialization in upper case) and Subsets (named "Node-subset", with
first letter in lower case).
This pages contains conventions that should be followed when writing VRML prototypes with MemoSDK.
Use convention for java classes naming (first letter upper case of word, following lower case).
Example: ScrollableText, Menu, ProgressBarMenu
Every prototype should have the following parameters :
Prototype should support screen resizing via the screenSize field.
Example of support of screen resizing:
Prototype should support style modification via the style field.
See Style for Javascript API and
CSS language for the CSS file syntax.
Example: