# Naming Conventions

## Consistent Naming Scheme <a href="#toc63157192" id="toc63157192"></a>

Names should have word boundaries. There are two popular options:

* **camelCase** *(first letter of each word is capitalized, except the first word)*
* and **underscores** between words *(like “user\_surname”).*

The underscore naming scheme in combination with the camelCase scheme is proposed for `rule set` names, as it can easily depict hierarchical structures, as shown below.

`Repository` names tend to be more humanly readable and are space separated words *(“Rule Wizard”, “Silly Selfies”, “Notepad Demo”)*. But consistency is always important, no matter what naming scheme is used.

![DEMO\_REPO folder](https://2423451286-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F42mDa58RoaDxb6t8mbaI%2Fuploads%2Fgit-blob-c4a221b728c758aa0ca8753055476ae0dc29d431%2F0.png?alt=media)

## Variable Names <a href="#toc63157193" id="toc63157193"></a>

Give readable variable names that are easily distinguishable in a variable listing and are helpful for debugging.

Variable names should also be independent of platform or environment, e.g. `CUSTOMER_NAME` and not `DEV_CUSTOMER_NAME`.

Capital letters with underscore-separated words are proposed for the Tomorrow Software environment. Below is a variable list example:

![Variables list example](https://2423451286-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F42mDa58RoaDxb6t8mbaI%2Fuploads%2Fgit-blob-7bdeca942670a3c948e6fe4d4d394a4c5c6d675f%2F1.png?alt=media)

## Temporary Variable Names <a href="#toc63157194" id="toc63157194"></a>

Temporary variables with the same prefix could all be deleted with the “**Delete Selected Variables**” rule which could be called before the rule set exit. This is a proposed practice, as it cleans up the variable list, which makes it easier for debugging.

Below is an example of setting the variable “`TEMP_COUNTER`” and later deleting it before exit.

![Schema example with named variables](https://2423451286-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F42mDa58RoaDxb6t8mbaI%2Fuploads%2Fgit-blob-a2a147dd3d05e5123c637a70bf4c52fade75e622%2F2.png?alt=media)

The resulting variable list on exit is shown below. Here you can notice that the “`TEMP_COUNTER`” variable is missing.

![Result, after deleting the TEMP\_COUNTER](https://2423451286-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F42mDa58RoaDxb6t8mbaI%2Fuploads%2Fgit-blob-601128f62fc28ca144f4d1cdb7cc052e1dc09fc8%2F3.png?alt=media)

## File Names <a href="#toc63157195" id="toc63157195"></a>

Variable values or parameter values that are file names should be **case-sensitive**.

In the below example the file’s name is “`index.html`” and therefore the parameter “File Name” should have the exact same case-sensitive value.

![File Reader rule](https://2423451286-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F42mDa58RoaDxb6t8mbaI%2Fuploads%2Fgit-blob-7a4f557d64c254dfed5401ea84e71bda4152477f%2F4.png?alt=media)

<div data-full-width="true"><img src="https://2423451286-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F42mDa58RoaDxb6t8mbaI%2Fuploads%2Fgit-blob-3b84a178b468fe33b6bd8836ffbd98e8c639d35b%2F5.png?alt=media" alt="File Reader rule propes"></div>

## Unnamed numerical constants <a href="#toc63157196" id="toc63157196"></a>

Avoid using unnamed numerical constants, as to make clear what the number is supposed to represent, and to accommodate future changes. Its value can be set into a variable, and then the variable can be used wherever needed.

In the future if a change needs to be made to this value, it can easily be made once only in the “Set Variable” rule.

In the example below the variable “**DAYS\_IN\_WEEK**” is assigned the value “7” instead of using the number “7” directly in the “Counting loop” rule.

![usage of the variable DAYS\_IN\_WEEK](https://2423451286-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F42mDa58RoaDxb6t8mbaI%2Fuploads%2Fgit-blob-03213aa00894a35a9d2ba72ac1253adc195ab25f%2F6.png?alt=media)

![Set Variable rule props](https://2423451286-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F42mDa58RoaDxb6t8mbaI%2Fuploads%2Fgit-blob-097f9897fafe2811365cebb0b2fb549a49ed1fda%2F7.png?alt=media)

## Avoid conflicts in rule set names among repositories <a href="#toc63157197" id="toc63157197"></a>

Rule sets that are exported from the repository should have unique names so that there are no clashes with other rule sets in the repositories in which they are included.

Below is an example of the repository “User Agent Detection” being included into the `DEMO_REPO` repository, under the label “Include data, content and rule sets from:”.

![DEMO\_REPO repository details](https://2423451286-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F42mDa58RoaDxb6t8mbaI%2Fuploads%2Fgit-blob-bdbaec2050ccb0e82d694fd7dd0f974ea02129a9%2F8.png?alt=media)
