Naming Conventions for Rules, Attributes, and Variables

Overview

Engineers, architects, and admins have free reign over what they name rules, functions, documents, attributes, and internal variables. However, it is imperative that all of these aspects of an implementation are given clear, useful, and at least semi-standardized names. Consistent and clear naming supports maintenance and add-on activities. Well-named Rules and Attributes are easier to identify, and code that uses well-named variables and functions is self-documenting.

Naming opportunities are ubiquitous across CPQ:

Administration

ClosedNaming Convention Rules

The name of a configuration rule should give an admin some insight as to what the rule does. Wherever possible, use names that evoke the business rules being implemented, using the terminology and language that the customer is familiar with. Remember, there are a number of attributes of rules stored as metadata, so it is not necessary to recapitulate them in the naming and it can clutter the UI if you do:

ClosedRecommendation Rules

Recommendation Rules are generally used in order to “set” values based on other values, or specify “default” values conditionally based on the initial state. This is useful if multiple flows inherit a collection of attributes. Examples:

  • “Defaults for NAM” might set a number of fields when the Quote Region is North America.
  • “Set Voltage based on Power Supply” might implement a dependency relationship from Power Supply to Voltage, perhaps using a mapping table.
  • “Require QuickStart Package for Users < 500” might force set Service Offering to QuickStart Package.

    • The important thing is to be consistent with the naming convention. Even if the site strays from the recommended methods, consistent names make it easier for users to administer the site.
    • If possible, decide early on in the implementation what the sort of naming convention will be used. If at any time you aren't sure, consult with the site's Solution Architect or lead engineer.

ClosedConstraint Rules

Constraint rules “limit”, “filter” or “remove” options that the user can select. Examples:

  • “Filter Model by Product Line” might implement a hierarchical relationship between Product Line and Model.
  • “Restrict Support Term by Support Type” might apply a table-based limit to the Support Term attribute which takes the Support Type attribute as input.

ClosedHiding Rules

Similar to other types of rules, name Hiding Rules based on the business rules they represent. In most cases, the rule should describe “what” is hidden (and optionally “why”):

  • “Hide Advanced Rack Configuration” might hide an array set of customized options if an “Advanced Rack Configuration” option is set to No.
  • “Hide Support Option if Subscription” might hide a Support Option attribute (or set) if a given item represents a Subscription (in which support is included).

ClosedRecommended Item Rules

Most sites have few enough recommended item rules (some have just two or one) that it's okay to just refer to the output. It's generally understood that the rule is probably either always true, or fires when the user starts to provide the input that generates the recommended items. Examples include:

  • Spares – Optional
  • Main Units – Mandatory
  • Software – Mandatory

    Consider including whether or not the rule type is Mandatory or Recommended. Since the word “Recommended” can be confusing, since all of these rules are of the “Recommended Item” type, the word “Optional” is a good substitute.


ClosedNaming Functions

Each function should have a meaningful name that accurately conveys what it does. Function/method names should start with a strong action verb, such as convert, divide, build, and so on. Get and set are often used in function names. The rest of the name should reference what the function is acting on or perhaps what it is returning. Examples include:


ClosedNaming Documents

There are two primary types of documents in CPQ:


ClosedNaming BML Variables

Often the sheer number of variables in BML scripts causes admins to give little thought to the variable names. Poorly chosen names can make code difficult or impossible to read.

The following table describes types of BML variables:


ClosedNaming Attributes

Follow the preceding recommendations for variables when naming Configuration and Commerce attributes. In addition, you should follow a naming convention that makes it easier to distinguish between Attributes and regular variables in a script, since they behave differently. For example, you cannot set the value of an Attribute in a script.

The following examples show "_object" convention used in QuickStart:

  • Quote: quoteNumber_quote, submittedDate_quote
  • Line: listPrice_line, isOptional_line
  • Model “Rack”: server_rack, memory_rack, (or simply server_m, server_pl, server_f, and so on.)

ClosedNaming Data Tables

To more easily distinguish between variables, use Capitalized CamelCase when naming Data Tables. Example:


Related Topics

Related Topics Link IconSee Also