0% found this document useful (0 votes)
6 views

Class, Object and Inheritance

Classes

Uploaded by

Dilip Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
6 views

Class, Object and Inheritance

Classes

Uploaded by

Dilip Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 13
It is a collection of rules. CLASS It is used to organize rules under an application. Itis a container holding different types of rules in it CLASS VS RULESET inal Ruleset:lt contains code (rules) + Data Class: It contains only instances(example :operators, access code(rules) groups , roles, privileges, workbaskets, service packages etc) BE Nata traning $B Natta trainings PEGA EXAMPLES OF CLASSES viene Gm a In Paytm application we provide various services to — wee oes = ~ customers 7 Every service needs a class and code writen under a Below are the list of classes in Paytm: O MovieTicket O TrainTicket O FlightTicket O Erecharge U BusTicket O ElectricyBitt us Tickets leet Bill Payment BE Nata traning OBJECT / WORK OBJECT/ CASES/INSTANCE: Example 1: + Amazon is my application + Orderis a Class in Amazon app. + In "Order class as a developer will write down code to ‘process order placed by end + Now when user buys a product from Amazon. Code will execute from order class in ‘backend and that transaction ig stored in data base. This Order placed by user Is work ‘object and itis stored in the DB. Object:instance of a class. Itis a transaction made at run time. Example 2: HDFC is my application writen code under this class to process loan requests. Now a User applied for loan in my project. + This loan applied by user is called as work object and itis, stored in do. Work object id: + Itis nothing but transaction id Unique identifier to store and retrieve a transaction + Example: Orderid 1342344 + Loanlé-VL1234 + Tieketle-TKT123 So Class is a collection of rules, when you use the application the rules under the class are ‘executed and output generated is called as work object. EXAMPLES OF work object Orders placed in Amazon Mobile recharge in Paytm Fund transfer ina bank See : ArciciBank * Poymentt R297 received by ayn! Amount transferred $10,000.00 2402786730 297 Totecicifoos ers.908s8 Recharge of Yeuray nn 46.0804 Sunde coupon coset O EXAMPLES OF WORK OBJECT ID OrderlD in Amazon ‘Transaction Id in Banking app TYPES OF CLASSES Concrete Class Abstract class. Abstract Class: Concrete Class: + Classes which cannot have work Classes which can have work objects created under them, ‘objects created under them. They ‘t can also act as parent classes and + Means No transactions under eons store reusable code, + Means no Db table mapping with tl have oD tablet store work class is required to store data objects and no work objects stored in Any class abstract or concrete Db. they can be a parent or child of any other class, What is the use of abstract class? Class is an instance of PEGA To store rules which can be reused Glass isan instance of PEGA ‘across allof its child classes, t EXAMPLES OF TYPES OF CLASSES Example: 1 Loan Abstract class ‘Registration, Login, Docs Validation , Loan approval process} These processes are reusable code so keep them in Parent class Loan and makelit abstract. Educ Above 3 child classes can reuse all the code in Loan abstract class jon Loan Vehicle Loan Home Loan —> Concrete classes & child classes Example: 2 Bookings Application Booking (Abstract class) {Gove for Payment through cre, debt wallet etc} These processes ae reusable code so keep them in Parent class Booking and meke'k sbsiract Flight Hotel Train Bus (Concrete class) {In all trese 3 classes we reuse Payment process logic from parent Abstract class Booking) SBR ata trainin. — CLASS GROUPS It is a collection of classes. It isa class group: This class is a parent class and itis willing to share its db table with its child classes, Belongs to a class group: This option is used in child classes to mention that they are sharing the table oftheir parent class. Does not belong to @ class group: This is used when a class neither shares table of its parent nor shares its table with its child classes Ex Loan is a parent class. Education loan, Housing loan vehicle loan child classes, Create a table called as Loan LOANNUMBER = LOANAMOUNT LOAN TYPE 123 100,000 VEHICLE LOAN 234 20,000 HOUSING LOAN 456 300,000 VEHICLE LOAN BE rari ron cece CLASS GROUPS It is a collection of classes. Loan class > Is a class group Vehicle Loan, housing Loan, Education Loan - > Belongs to a class group Table: Countries-> does not belong to a class group. INDIA USA UK CANADA, BM Natta trainings TYPES OF INHERITANCE There are 2 types of inheritance in Pega. 1.Pattern 2.Directed Pattern Pattern Inheritance: Current class naming pattern indicates the parent classes. ‘A-B-C-D-E (Current Class =E) Parent of Eis A-B-C-D ‘A-B-C-D (Current class=D) Parent of D is A-B-C A-B-C (Current class=C) Parent of C is A-B ‘A-B (Current Class is B) Parent of B is A A (Parent of A will be @baseclass) At Run time we will look for rules in current class and if not found we check in all pattern parents,till we reach @baseclass DIRECTED INHERITANCE We explicitly map a class as a parent of another class. We map in class Definition rule form. Why do we need direct inheritance? + When we want to inherit from another class which is not your pattern parent class then we map that class as directed parent and inherit from i. + We cannot build application in Pega without direct inheritance as our org layer has direct inheritance with pega builtin classes. Ae err + Class D want to inherit code from Class Z. So using directed inheritance concept we can make X-¥-Z as a secondary/directed parent to A-B-C-D. + When we are searching for any rusle we search in below pattern ABOD> ABO>ABOA 2XY-ZOXV> X + We always check for pattern parents first and if rule is net found there then we move to directed parents. Can we search in directed parents classes first and if rule is not found then check in pattern parents -Is this configurable? Yes it can be done by unchecking the ‘Find by pattern first check box" under Inheritance in class rule form BE Nata traning Important Points: @baseclass is top most class in Pega and its Abstract class. Acclass can be Abstract or concrete but still have both directed and pattern inheritance.

You might also like