How to naming
This document defines the naming conventions to use when performing standard or specific development tasks to avoid naming conflicts. Some of the rules stated below are classified as strict recommendations and must be followed rigorously. Others are suggestions that will be validated later.
Type | Recommendations |
---|---|
Strict | Dictionary naming |
Strict | Method naming |
Strict | Local menu naming |
Recommendation | Script naming |
Recommendation | Collection naming |
The code that identifies a dictionary element must follow these naming rules. This includes the following elements:
For these elements, the applicable rules are as follows:
Naming pattern | Use |
---|---|
A* | Supervisor elements. |
B* to T*, V* | Standard elements. |
U* | Table starting with U are usually reserved for temporary tables used during updates. |
W* | Generated elements. Those are only generated by an automatic process; modifying them manually is forbidden. |
X* | Add-on codes that might be developed outside of Sage. |
Y*, Z* | Specific elements developed outside of Sage. |
QLFarea_case | Test cases for automated tests. It is good practice to group the unit tests of the same area by having a common prefix. The naming rules are:
|
Note: By default, when using the meta data generation tool, the collection is called according to the pattern L* (previously C*). It is not recommended to keep this style of collection name because it is difficult, and therefore, makes the code less readable. It is recommended to rename a collection by giving it a clear and explicit name that does not conflict with other properties.
It is important to distinguish between public methods that can be used by any developer using a class delivered in the standard, and private methods that are defined for internal use of the class implementation.
The private methods need to be prefixed by an underscore followed by a character that corresponds to the naming rule previously defined. For example:
The private methods are not documented and are subject to change without notice. To avoid their use by developers that don't follow the rules, it is recommended to implement the corresponding code in a separate script that is not supplied in the source.
MISCELLANEOUS TABLES | |
---|---|
Range | Use |
1000-1999 | Vertical developments |
4000-4999 | Addons |
6000-6999 | Specific developments |
8000-8999 | Localizations |
13000-13999 | Addons |
18000-29999 | Addons |
LOCAL MENUS | |
Range | Use |
160-164 | Messages for specific developments |
165-169 | Messages for vertical developments |
1000-1999 | Local menus for vertical developments |
4000-4999 | Addons |
5100-5199 | Messages for vertical developments |
5100-5199 | Local menus for vertical developments |
5200-5999 | Local menus for vertical developments |
6000-6199 | Messages for specific developments |
6200-6999 | Local menus for specific developments |
8000-8999 | Localizations |
13000-13999 | Addons |
18000-29999 | Addons |
There is no strict recommendation about the script organization except for the following rules:
A script storing a library of functions must follow the naming rules previously defined (prefix).
When functions are written for native version 7 functions, it is strongly recommended to write them in scripts that don't contain version 6 code. This will help in the future to deprecate the version 6 code.
We need to distinguish the scripts containing version 7 native code from the scripts containing version 6 code. We considered a recommendation to add _SYRA
to the end of the script name, but this might be awkward, and maybe we can find a better recommendation, such as, LIB_ means library, xxxx is an additional significant name. Further discussion is needed.
If we consider the TRTDEV V6 script that contains miscellaneous scripts related to currency controls(currency is spelled "devise" in French), the recommendation is to have a name that contains CUR (LIBCUR_SYRA,or CLIB_CUR, if we consider that C might be the abbreviation of core). Of course, this script will only contain code that is version 7 compliant. If there is a subprogram that controls the currency, it would also be nice to rename it from "CONTDEV"to "CONTCUR."
A good practice is to avoid Subprog when creating functions in libraries, and to use Funprog instead to simplify error handling. In a case where this is not relevant, we don't have an error class that would handle the error in a simple way. So then the normalization is:
AMSG
data type) that returns the error message if an error was raised.A script associated with a class is by default created with a name in 4 segments with an underscore between the second and third segments. This creates a name in the AB_CD format, where:
C
if the script is related to a class, and R
if the script is related to a representation.STD
for standard, SPE
for specific, VER
for vertical.For example, a vertical developer using the prefix XVE
for all his dictionary elements has a vertical script associated to the standard class BPCUSTOMER
. The recommended script name would be:
A collection is a property like any other. Using prefixes like C_ is strongly not recommended, for several reasons:
This doesn't mean that naming frequent collections is not valuable. For example, having a standard short name for addresses, or cost accounting segments can be a good idea. A simple name such as IADD
(invoice addresses), OADD
(order addresses), or CCE
(cost accounting) can be clear enough.