To save development time when creating an application, reuse rules by organizing them into classes, and then creating dependencies between the classes. When you create a class hierarchy you define which classes contain other classes, and as a result, you define how classes reuse or inherit rules.
In Pega Platform, you can create parent classes that contain child classes. Any rules available in a parent class are also available to the child classes. Because of this, Pega organizes classes in the following groups:
- The ultimate base class, which Pega Platform provides and identifies by the keyword @baseclass. The ultimate base class is a root for all other classes.
- Base classes that store the rules that provide basic functionality for processing cases, such as data elements that record the creator of a case. The most common base classes include Work-, Data-, and History- classes.
- Classes from other applications, such as industry-specific Pega applications. For example, you can use a generic application for policy administration as a base for customizing versions for different policy types.
- Classes that collect rules and data elements that are common at the division and organization level, such as a class that stores an approval process shared across an entire IT department.
- Classes that describe a specific case type, such as expense reports or vehicle insurance claims.
The Records Explorer lists child classes under their parent class.
Careful planning and analysis are important when creating new classes, so that you can understand their interrelationships and plan their positions in the standard class hierarchy. Maximizing reuse of standard classes, standard properties, and other standard rules supports fast development with less effort. You can also provide for greater reuse of classes by creating class groups. A class group data instance unifies a set of classes in the PegaRULES database that share a common name structure and common key structure. All classes that belong to the same class group share one database table. For more information about class groups, see Working with class groups.
Class naming convention
The names of all classes that belong to a common class group start with the class group name, followed by a hyphen. For example, if you define a class group Work-Object-App-Task, you can name the child classes in this class group Work-Object-App-Task-Ordering, Work-Object-App-Task-Shipping, and Work-Object-App-Task-Billing.
For more information about class names, see Naming conventions for classes.
Classes can inherit rules in the following ways:
- Pattern inheritance
- A class inherits characteristics automatically through the class name structure. Pega Platform uses a multi-level class hierarchy of Organization (Org), Division (Div), Unit and Class group to organize application assets. During rule resolution, the system looks for rules from the bottom of the class hierarchy (the most specific class), to the top, (the ultimate base class). The system can reuse rules only within one application.
- Directed inheritance
- A class inherits characteristics directly from a specified parent class, regardless of any defined pattern inheritance. You typically apply directed inheritance to reusing standardPega Platform rules and rules from other applications outside the business class hierarchy.
For learning materials about inheritance patterns, see a Rule reuse through inheritance topic on Pega Academy.
For learning materials about classes, see a Classes and class hierarchy topic on Pega Academy.