General
Where ever identifier is required (uniqueName, name, etc.) field is used, it is recommended to use identifiers in a ClassicalCamelCaseFormAsYouKnowItFromJava, e.g. SalesPrice. If there is a abbreviation used in the name, it is naturally useful to separate it with underscore character "_", for example as ABC_Class instead of ABCClass.
Labels are typically copy of the uniqueName/name and the words are split using spaces.
Here are some commonly used conventions for the identifier suffixes:
Suffix | Example | Label | Meaning |
---|---|---|---|
Diff | VolumeDiff | Volume ∆ | represents difference between actual and previous value |
Abs | MarginAbs | Margin ∆ | Margin represented as amount (typically formatted as Money) |
Pct | MarginPct | Margin % | Margin represented as a percentage (typically formatted as Percent) |
s | pxRecords | representing a List of values |
The suffixes can be combined
Logic names
Follow general rule with using a first letter in uppercase.
Example: DefaultLogic, Pricelist, Main, DefaultQuoteLogic
For the following logic types, there is a recommendation for a prefix/suffix:
Logic type | Formula Nature | Prefix | Suffix | Example |
---|---|---|---|---|
Calculation Flow | calculationFlow | CF_ | CF_DailyCalculation | |
Calculated Field Set | (default) | CFS_ | CFS_ProductEnrichment | |
Dataload | paDataLoad | DL_ | DL_LoadFromPX | |
Groovy Library | library | Lib | SharedLib |
Element names
Follow general rule with using a first capital letter. The library element names should have a suffix "Utils" (e.g. RoundingUtils, CacheUtils, DatamartUtils).
The reason for a first letter is that element is implemented as a Groovy class and therefore referring to element's methods from Groovy is done as SomeElement.callSomeMethod(). For this syntax the method auto-completion will work in Studio, since IDEA will understand it as a static call of a method (even though it is in reality not a static call but an instance call on a binded object).
Another reason for a capital letter is to have the possibility to refer to previous elements - PM-284Getting issue details... STATUS .
In order to make auto-completion working in Studio or to be able to run TDD4C without marking the folders as source in Studio, it is recommended to use always a different element name that is unique within the project.
Example: NewMargin, SalesPrice
Element Labels
Element names should ideally be matching the element name where spaces are used and each word starts with a capital letter which is commonly used pattern in UK or US.
The element label should not be identical to a different element name or field name, since functions accept both label and element.
The basic rule is that labels can be adjusted at any point of time. Therefore the labels should not be referred in the logic, element name or attribute should be used.
Groovy variables
Follow general rule with using a first letter in lowercase. Even though Groovy, compared to Java, allows first letter in uppercase, following Java convention is recommended.
Example: newMargin, salesPrice
If the variable stores a list of values, then the suffix "s" (English plural) can give a hint it is storing multiple values.
def records = api.find(...) for (record in records) { //do something with with record.attribute1 ... }
Groovy methods
Follow general rule with using a first letter in lowercase. Even though Groovy, compared to Java, allows first letter in uppercase, following Java convention is recommended.
Example: getCostPrice()
DF/DS/DM fields
Follow general rule with using a capital first letter.
TODO: should be changed to lower case due to better use in SQL queries?
Example: NewMargin, SalesPrice