Naming conventions for classes
Unified naming standards for classes help you manage your resources in a logical and efficient way. You can avoid duplicating your content, maximize efficiency, and speed up application development by sharing resources between multiple classes or class layers.For example, you can create class names that support class inheritance, so that you can reuse resources across different classes. When you name a class RequestReviews-LoanRequests, you indicate that a new class LoanRequests inherits resources from the RequestReviews class.
When you name classes, consider the following guidelines:
- Use a noun for a class name, for example Customer or Address to distinguish classes from actions and processes. For better readability, capitalize the first letter of each word, for example, CustomerDetails.
- Ensure that your class name is descriptive and clearly conveys the purpose of the class.
- Avoid using acronyms and abbreviations that are difficult to decode. The exception are common acronyms, such as HTML.
- Avoid including underscores (_) in class names.
- Pega Platform provides a set of base classes that includes the Work-, History-, and Data- classes. Create new classes only under the organization base class, for example, UPlusTelco-.
- The system displays labels for class names on some of the forms, worklists, reports, and other areas of an application. The system also displays a short description for the class. Therefore, use class names that are self-explanatory and reflect the purpose of the work. Avoid using class names that reflect a status or action, instead of a unit of work.
- Choose class names that support pattern inheritance, as well as directed inheritance. For more information about class inheritance, see Understanding class hierarchy and inheritance.
- To distinguish hierarchy position and inheritance, use class names that visually reflect pattern inheritance. For subclasses, include the names of all parent classes, including your top-level class, separated by dashes. For example, if the parent class YourCoLoan-Request includes child classes for mortgage and car loan applications, name the child classes YourCoLoan-Request-Mortgage and YourCoLoan-Request-Auto.
- Name related objects with consistent prefixes, so that you can quickly locate similar classes in an alphabetical list.
- Use the same naming conventions for class groups as for classes.