Skip to main content

Rule reuse through inheritance

Inheritance allows your application to reuse existing Rules for other Cases or applications. Rule reuse through Rule inheritance reduces development and testing time without sacrificing application quality.

Note: Determine the Reusability of the Rule to decide where the Rule should be placed in the class and Ruleset hierarchy.

Pega Platform™ provides two methods for Rule inheritance: pattern inheritance and directed inheritance.

Pattern inheritance

Pattern inheritance is automatic. Pattern inheritance uses the existing class name structure to determine which Rules are available for reuse. Pattern inheritance searches classes that share a class name prefix. Pattern inheritance promotes reuse based on business suitability because Rules are aggregated at higher levels to reflect their usability throughout an entire division or organization. For example, a Rule applied at the division level that defines elements of payment processing for insurance claims can be reused by each claims department belonging to that division.

The following image illustrates a basic pattern inheritance hierarchy for an insurance company (ABCIns) and two of its divisions: Consumer and Business. The ABCIns class is the parent class to two child classes (ABCIns-Consumer and ABCIns-Business) which are themselves the parent classes to ABCIns-Consumer-PolicyProcessing and ABCIns-Business-PolicyProcessing, respectively.

In the following image, click the + icons to learn more about pattern inheritance:

Directed inheritance

Directed inheritance is inheritance between classes where the parent class is explicitly specified, unlike pattern inheritance, which is automatic. You apply directed inheritance to reuse standard Pega Platform Rules and Rules from other applications outside the business class hierarchy. You list directed inheritance on the class Rule form. Because Rules are aggregated based on whether they apply to all Cases or Cases of a certain type, directed inheritance promotes reuse based on functional suitability.

For example, a Rule may be limited to a specific implementation, such as an auto insurance application, or applied to all implementations, including applications for property and marine insurance.

Class rule with directed inheritance

Directed inheritance is the option that allows an application class to inherit Rules defined for standard Pega classes, such as the Work- or Data- class.

Note: Set the Rules in a higher parent class if you anticipate reusing them to avoid duplicate Rules. When creating a new Rule that is similar to an existing Rule, refactor the Rule to use parameters instead of creating multiple versions of the Rule. 

For example, consider an organization named TGB that has an IT application with Ticket Cases and an Accounting application with Purchase Request Cases. Both the Ticket and Purchase Request Case Types use a property, .pxCreateOpName, to record the name of the operator that creates the Case. Through directed inheritance, both Cases inherit the property which is defined in the Work-Cover class.

TGB example showing pattern and directed inheritance

Check your knowledge with the following interaction:

Inheritance and Rule reuse

Pega Platform first searches through the parent classes indicated by pattern inheritance when reusing Rules through inheritance. If unsuccessful, Pega Platform then searches the parent class indicated by directed inheritance as the basis for another pattern inheritance search. This process repeats until the system reaches the last class in the class hierarchy, called the ultimate base class or @baseclass. If the system cannot find the Rule after searching @baseclass, Pega Platform returns an error.

Consider the following example in which an auto insurance claim Case references the field that stores the Case ID. The application containing the auto insurance claim is built on a generic policy administration application. That generic application is built on the Pega Platform.

In the following image, click the + icons to learn more about how Pega Platform searches for the Case ID:

Check your knowledge with the following interaction:


This Topic is available in the following Module:

If you are having problems with your training, please review the Pega Academy Support FAQs.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Academy has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice