Table of Contents | ||
---|---|---|
|
General
Where ever Whenever an 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 an underscore character "_", for example as , ABC_Class (instead of ABCClass).
Labels are typically a copy of the uniqueName/name and the words are split using spaces, e. g. Sales Price.
Here are some commonly used conventions for the identifier suffixes:
Suffix | Example | Label | Meaning |
---|---|---|---|
Diff | VolumeDiff | Volume ∆ | represents Represents the difference between an actual and previous value |
Abs | MarginAbs | Margin ∆ | Margin represented as an amount (typically formatted as Money) |
Pct | MarginPct | Margin % | Margin represented as a percentage (typically formatted as Percent) |
s | pxRecords | representing Represents a List list of values |
The suffixes can be combined.
Logic
...
Names
Follow The general rule with using a is to make the first letter in uppercase.
Example: DefaultLogic DefaultLogic, Pricelist, Main, DefaultQuoteLogic
...
For the following logic types, there is a recommendation for a recommended 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 The 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 is to make the first letter uppercase. The reason is that the element is implemented as a Groovy class and therefore referring to the element's methods from Groovy is done as SomeElement.callSomeMethod(). For this syntax the method auto-completion will work in Pricefx 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 Another reason for a the first capital letter is to have the possibility to refer to previous elements:
Jira Legacy | ||||||
---|---|---|---|---|---|---|
|
In order to make the auto-completion working work in Studio or to be able to run TDD4C without marking the folders as a source in Studio, it is recommended to always use always a different element name that which is unique within the project. Also the element name "Filter" is not recommended, since the auto-completion collides with the standard Filter object used frequently by the logics.
The library element names should have a suffix "Utils" (e.g. RoundingUtils, CacheUtils, DatamartUtils).
Example: NewMargin, SalesPrice
Element Labels
Element names labels should ideally be matching match the element name where just spaces are used added 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 time and so you should not refer to labels in the logic, instead use the element name or attribute should be used.
Groovy
...
Variables
Follow The general rule with using a is to make the first letter in lowercase. Even Even though Groovy, compared to Java, allows the first letter in uppercase, following it is recommended to follow the 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 that it is storing stores multiple values.
Code Block | ||
---|---|---|
| ||
def records = api.find(...)
for (record in records) {
//do something with with record.attribute1
...
}
|
Groovy
...
Methods
Follow The general rule with using a is to make the first letter in lowercase. Even Even though Groovy, compared to Java, allows the first letter in uppercase, following it is recommended to follow the Java convention is recommended.
Example: getCostPrice()
DF/DS/DM
...
Fields
Follow The general rule with using a capital is to make the first letter uppercase.
TODO: should Should this be changed to lower case lowercase due to better use in SQL queries?
Example: NewMargin, SalesPrice