EPL naming conventions

It is recommended that you use the following naming conventions in EPL. These conventions closely follow Java naming conventions. Using these conventions makes it easier to collaborate and makes it faster for Cumulocity product support personnel to follow your code.

Item              Convention             Notes and Examples

Acronyms

Do not always use all capitals

Names often contain standard abbreviations, such as IAF for Integration Adapter Framework. Names such as iafInterface for an attribute or IafInterface for a monitor are easier to read than iAFInterface and IAFInterface.

Actions

lowerCamelCase

Actions should be verbs, in mixed case with the first letter lowercase, and the first letter of each internal word capitalized. For example:
handleQuery();
startDaemonProcess();
quit();

Channels

package. UpperCamelCase

Channel names should start with an EPL package name (lowercase), optionally followed by an UpperCamelCase noun. Qualifying channel names with a package is important because channel names form a global namespace that is shared by all applications running in a correlator. For example:

com.mycompany.AllTransactions

Constants

ALL_CAPITALS

Identifiers for constants should be all uppercase with words separated by underscores. For example:

constant integer MAX_SIZE;
constant string DEFAULT_HOST;

Contexts

UpperCamelCase

Context names should be nouns, initial capital, in mixed case with the first letter of each internal word capitalized. Context names should be simple and should describe the work being done in the context. Use whole words. Avoid acronyms and abbreviations unless the abbreviation is much more widely used than the long form, such as URL or IAF. For example:

context("Calculation");
context("Inventory", true);

Custom aggregate functions

lowerCamelCase

Custom aggregate functions should be in mixed case with the first letter lowercase, and the first letter of each internal word capitalized.

aggregate bounded myCustomAggregate()
   returns integer { *aggregateBody* }

Events

UpperCamelCase

Event names should have an initial capital, and mixed case with the first letter of each internal word capitalized. Event names should be simple and descriptive. Use whole words. Avoid acronyms and abbreviations unless the abbreviation is much more widely used than the long form, such as URL or IAF. For example:

event Tick
event SubscriptionConfiguration
event IafEvent

Monitors

UpperCamelCase

Monitor names should be nouns, initial capital, in mixed case with the first letter of each internal word capitalized. Monitor names should be simple and descriptive. Use whole words. Avoid acronyms and abbreviations unless the abbreviation is much more widely used than the long form, such as URL or IAF. For example:

monitor SubscriptionManager
monitor IafMonitorService

Packages

lowercase

The prefix of a unique package name is always written in all-lowercase ASCII letters and should preferably be one of the top-level domain names (com, edu, gov, mil, net, org) or one of the two-letter codes identifying countries as specified in ISO 3166-1 alpha-2. Subsequent components of the package name vary according to an organization’s own internal naming conventions. Such conventions might specify that certain directory name components be division, department, project, machine, or login names. For example:

com.apamax.accounting

Variables

lowerCamelCase

Variables and parameters should have initial lowercase. This is left to your discretion, but lowercase is preferable. Internal words start with capital letters. Variable names should be short yet meaningful. The choice of a variable name should be mnemonic: that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary, throwaway, variables. Common names for temporary variables are i, j, k, m, and n for integers.

integer i;
float myPrice;
MyEvent myEvent;