Discussion

45
Views
BraamCLSA Member since 2012 100 posts
PEGA
Posted: 1 month ago
Last activity: 1 month ago

Inheritance: Direct-inheriting from multiple reuse layers [LSA Data Excellence]

How do I inherit from two Classes - each residing in multiple reuse layers - when pattern-inheritance is not appropriate for either? (e.g. MyOrg-Data-DualAddress inheriting from both PegaApp-Address and PegaData-Address)

Firstly, consider whether you genuinely need to inherit from both superclasses. You may be content to inherit from one and implement a small number of subclass-specific rules to emulate what you need from the other. This presents an upgrade risk as you forego any improvements later released in the "other" superclass.

Also, check in to ensure that the two classes in question don't already have an inheritance relationship between them. PegaApp-Address may already inherit from PegaData-Address, in which case a class that direct-inherits from PegaApp-Address also get PegaData-Address from direct inheritance, and you don't have to do anything further.

If dual-direct-inheritance is genuinely needed, and neither of the above apply, you can create a pattern-inheritance "bridging" subclass of one of the two classes you want to inherit from, and have that bridging class direct-inherit from the other. For example:

  • PegaApp-Address-Bridge : the new "bridging" class, which:
    • Direct-inherits from PegaData-Address; and
    • Pattern-inherits from PegaApp-Address
  • MyOrg-Data-DualAddress : direct-inherits from PegaApp-Address-Bridge

Instances of MyOrg-Data-DualAddress:

  1. Firstly, pattern-inherit up to MyOrg;
  2. Then direct-inherit PegaApp-Address-Bridge, which:
    1. Follows pattern-inheritance to PegaApp-Address; then
    2. Follows direct-inheritance to PegaData-Address

As per Guidance on setting up to utilize inheritance, you will need to decide which of the two reuse layer classes should "win" if a rule provided by both of them is referenced from an instance of MyOrg-Data-DualAddress. Position the class you want to "win" as the pattern-inheritance superclass of the bridging class.

The below is the Inheritance view from Dev Studio of implementing the above:

Dual Inheritance of 2x Address classes from different class structures

In this example, PegaApp-Address - as the pattern-inheritance superclass of the bridging class - will "win" when a rule implemented in both PegaApp-Address (#5) and PegaData-Address (#7). Note also that if we were interested in capability from Data-Address-Postal (#9), we have achieved this with no effort by ensuring PegaData-Address (#7) is on the direct-inheritance path from our #1 class.

Discussion on this topic was sought from the LSA Data Excellence (Pega 8.4) webinar conducted in July 2020. The webinar and its full set of discussions that arose from it are available at LSA Data Excellence: Webinar, Questions & Answers

Pega Platform 8.4.1 Data Integration Case Management Lead System Architect Senior System Architect Developer Knowledge Share
Share this page LinkedIn