Pega 7-Class Structures and Hierarchy Design - v001
Pega 7-Class Structures and Hierarchy Design - v001
Design
LEVEL – PRACTITIONER
About the Author
2
Icons Used
Hands on
Questions Tools Exercise
Best Practices
Demonstration & Industry
Workshop
Standards
3
Introduction
4
Objectives
5
Do You Know
6
4 - Layer Class Structure
7
Layers in the generated class structure
• Divisional Reuse: For assets that need to be reused on a division-wide basis. Such
assets are rules for division-wide business logic (such as standard properties,
decision tables, Service Level rules) and division-wide data assets (such as classes
and rules for data stored in the system, and classes and rules for access to data in
external systems, via connectors).
8
Layers in the generated class structure
(Contd.)
For example, a division wants to reuse a service level rule that defines the expected
response time to a customer complaint in all of its applications, so that it can
consistently enforce a focus on meeting its customer relationship commitments.
9
Layers in the generated class structure
(Contd.)
A CBF must be able to stand on its own; therefore, this layer contains all rules
necessary to implement its functionality. While there will be a class group and its
mapping to a database table for testing purposes, the actual mapping of the application
to production database table occurs on the Implementation layer. Organization specific
logic, processes and rules must be placed on the Implementation layer as well; only
default edits, values, and application structures have their home in the CBF layer. The
CBF and its implementation classes can be considered the equivalent of an “ASP”
model, where the CBF is the base application. Pegasystems-built frameworks also
reside in the Framework layer. A customer application that is built on a Pegasystems
solution framework may directly implement the solution framework classes, or they
may be a CBF themselves. In the former case, there are one or more specialization
layers on the Implementation level, and the Pega solution framework on the
Framework level. In the latter case, there are one or more specialization layers on the
Implementation level and the CBF and the Pega solution framework on the Framework
level. The CBF has the Pega framework as its directed parent.
10
PRPC Solution Frameworks :with (F1) and
without (F2) a CBF
11
Layers in the generated class structure
(Contd.)
• PRPC Base :Consists of the PRPC system's built-in classes and rules necessary for
processing cases and other work in PRPC applications, as well as for areas of PRPC
itself.
12
Layers in the generated class structure
(Contd.)
• NOTE: Starting with PRPC 7.1, abstract class names generated by the Application
Express do not contain a trailing hyphen. For example, MyCo- class would be
named MyCo. Extending from Work-Cover- (not just Work-) is required for
applications that leverage case management features. In PRPC V7, extending from
Work-Cover- is the default (when the class is created using application express) to
make it easier for all newly generated applications to leverage case management.
13
A Practical Example
14
Creating PRPC Class Structure
15
Abstract and Concrete class
• An abstract class is a class rule created to support the definition of rules, including
other classes. Such rules can be inherited by subclasses of the abstract class. Rules
with a class as a key part (such as properties, activities, flows, models, and so on)
can apply to an abstract class. A dash or minus character (-) as the last character in
the class name indicates an abstract class.
• A concrete class can have instances stored in the database. In contrast, an abstract
class cannot have any instances. If concrete class is created with an intent to store
instances then appropriate keys needs to be defined in the class form.
16
Class Groups
• Class groups are commonly used to cause the system to store instances of similar or
related work object concrete classes together in one relational database table. This
is also known as a work pool. It causes the system to store the instances
corresponding to two or more concrete classes that share a common key format in a
single database table.
• For rule resolution purposes (not database storage purposes) classes in the class
group can derive from (inherit rules from) the class with the same names as the
class group, but this is not required. Because of directed inheritance, classes in the
class group can inherit rules from elsewhere in the hierarchy.
17
Pattern Inheritance
• Pattern inheritance causes the system to search for a rule in classes derived from
the current class name by truncating, from the right, alphanumeric segments that
follow a hyphen (dash) character. “Find by name first (Pattern)? “check box on
the Class rule form to instruct the system to use pattern inheritance for this class. A
dashed black arrow ( ) indicates a pattern inheritance relationship; the arrow
head identifies the pattern parent class. For example, a request for a rule in the
WalCare-Financial-Credit class causes the system to search through these classes, in
the order indicated:
• WalCare-Financial-Credit
• WalCare-Financial-
• WalCare-Financial
• WalCare-
• WalCare
18
Directed Inheritance
• PRPC allows you to name a parent class in the class form, which is not related to the
name of this class. A solid arrow indicates a directed inheritance relationship( ).
The arrowhead identifies the class of the immediate directed parent.
19
Directed Inheritance (Contd.)
5. If not found, determine whether the parent class uses pattern inheritance. If
so, repeat this algorithm, starting at step 1, with the parent class.
20
Pattern and Directed Inheritance
21
Work- Class
• The Work- base class, one of fourteen standard top level abstract classes, is a
superclass to all the classes that define work objects. A work object is the
fundamental unit that records processed work in an application.
• Properties, HTML forms, and flows in the Work- class are available to support the
behavior and appearance of every type of work objects, including
• Ordinary work objects, typically belonging to the a class derived from the standard
abstract class Work-Object-
– Covers, typically belonging to a concrete class derived from the Work-Cover-
class
– Folders, typically belonging to a concrete class derived from the Work-Folder-
class
– The external key to all work objects is recorded in the pyID property, and
typically consists of an alphabetic prefix, a dash, and an arbitrary but unique
number.
22
Work- Class (Contd.)
The external key to all work objects is recorded in the pyID property, and typically
consists of an alphabetic prefix, a dash, and an arbitrary but unique number.
23
Inheritance Structure of Work Classes
• @baseClass
Work-
Cover-
Folder-
Object-
24
Creating PRPC Class Structure
25
PRPC Class Structure Example
26
PRPC Class Structure Example (Contd.)
27
PRPC Class Structure Example (Contd.)
Extending from Work-Cover- (not just Work-) is required for applications that leverage
case management features. In PRPC V7, extending from Work-Cover- is the default
(when the class is created using application express) to make it easier for all newly
generated applications to leverage case management.
28
Reusability
• Reusability is the ability of PRPC to share the same instance of a rule, RuleSet,
and/or service so that it can be used by other portions of the same application
and/or other applications.
• A robust class structure is the foundation of reuse throughout your application. The
PRPC recommended class structure design pattern offers flexibility in your design
and provides for more level of reuse.
• The class structure provides the first and most important layer of reuse in
PRPC due to its precedents in the rule resolution algorithm.
• The class structure provides you with a hierarchy in which rules can be
placed. The higher a rule is in the hierarchy, the more potential reuse there is.
• The key to a good class structure is that there are enough layers and classes
to hold the most fundamental levels of reuse but not too many that it
becomes cumbersome to navigate and unclear as to the intent.
30
Examples of Reusability and Security
• An Insurance company has a division Long Term Care which is accessed by its
various line of businesses like Retail, Group etc. The top most layer is myCo-LTC-
Claims where the base rules are defined. For different LOBs there are classes like
myCo-LTC-Claims-Retail, myCo-LTC-Claims-Group, myCo-LTC-Claims-Fortis etc
• Rules that are common across all the divisions in the organization are to be defined
in the top layer (myCo-LTC-Claims) and also can be reused if any new division is
introduced later in the organization.
31
Class Structure and Security
• Class Structures also help in applying security controls across the organization.
• It can be achieved by defining access role objects which map access roles to certain
classes. Users having those roles can then Open/modify/delete instances of that
particular class.
• Then assign these roles to the users who you want to be able to access the
functionalities defined via those classes.
32
Class Structure and Security (Contd.)
33
Work Id Creation
• A work object ID is the permanent, external identifier of a work object, the value of
property Work-.pyID.
• For every work object, prefix must be present whereas suffix is optional. The
standard utility activity named Work-.GenerateID uses the standard properties
pyWorkIDPrefix and pyWorkIDSuffix in its computation.
• For example, the prefix of work object Q-1432 is Q. The prefix of the work object
MORT-763-K4 is MORT. The suffix of work object is K4.
• If you don't specify a prefix, the Work-.GenerateID activity uses W as the prefix and
no suffix. The Work-Cover-.GenerateID activity uses C as the default prefix which is
specified in the models present in Work-Object- and Work-Cover- classes.
Conventionally, the F prefix identifies folder work objects.
• The internal class Data-UniqueID supports work object numbering, and ensures
that work object IDs are unique system-wide, not just within an application or
organization.
34
Learn How - Coding Standards
35
Questions
36
Welcome Break
37
Case Study
38
Best Practices and Industry Standards
1. Classes
• PRPC is enterprise software. Therefore, we must design applications with re-
usability and scalability in mind. As an integral part of every PRPC application the
class hierarchy is the foundation for reuse. PRPC has both pattern and directed
inheritance, mechanisms which provide superior flexibility for reuse. The best
practice Enterprise Class Structure (ECS) design pattern is the basis for divisional
and enterprise-wide reuse.
• The Best Practice is to use Enterprise Class Structure
• Avoids name space collisions and allows PRPC applications to coexist with each
other and with Pega and 3rd party frameworks;
• Allows applications to integrate with legacy systems;
• Enables you to harness the power of PRPC by taking full advantage of Rule
Resolution and rule specialization in your design;
• Helps avoid costly re-factoring;
• Is the class structure that the Enterprise Application Express generates
39
Best Practices and Industry Standards
(Contd.)
1.1 Name:
• Start Class name with capital letters. Start Words within name with capital letters
and ensure that class name does not contain underscore.
• Example:
Good Practice:
• (1) MyCom-
• (2) MyComp-MyDiv-
• (3) MyComp-MyDiv-MyApps- etc
Bad Practice:
• (1) My_Com-
• (2) Mycomp-My_Div-
• (3) Mycomp-Mydiv-My_Apps- etc
40
Best Practices and Industry Standards
(Contd.)
Classes represent units of work, so class names are generally nouns to distinguish them
from actions and processes
Example:
(1) MyCom-
(2) MyComp-MyDiv-
(3) MyComp-MyDiv-MyApps- etc
• Adopt logical, descriptive naming conventions for class structure
• Class names are visible labels in forms, work lists, reports, and other areas of an
application. Hence these should be self-explanatory and reflect the purpose of the
work
• Avoid class names that reflect status or action, instead of a unit of work
Example:
MyComp-MyDiv-MyApps-EmailAgent-EmailProcessing
MyComp-MyDiv-MyApps-EmailAgent-ReplyStatus
41
Best Practices and Industry Standards
(Contd.)
• Related objects should be named similarly, with consistent prefixes, for quickly
locating similar classes in an alphabetical list.
• By convention, abstract class names end with a dash, while concrete class names
don’t
• Indicate class behavior by self-explanatory name whether it’s a work object, a cover,
or a folder
• Example: The RulePro sample application has PegaRP-Work-Object- (parent class
for work objects) and PegaRP-Work-Project- (parent class for covers)
42
Best Practices and Industry Standards
(Contd.)
• To distinguish hierarchy position and inheritance, use class names that visually
reflect pattern inheritance. Subclasses should include the names of all parent
classes (including your top-level class), separated by dashes.
• Example: If the parent class YourCoLoan-Request- has child classes for mortgage
and car loan applications, name them YourCoLoan-Request-Mortgage- and
YourCoLoan-Request-Auto-
43
Source
• http.pdn.pega.com
• Developer help available with PRPC 7.1.4
Disclaimer: Parts of the content of this course is based on the materials available from the Web sites and books
listed above. The materials that can be accessed from linked sites are not maintained by Cognizant Academy and
we are not responsible for the contents thereof. All trademarks, service marks, and trade names in this course are
the marks of the respective owner(s).
44
Class Structures & Hierarchy
Design