SlideShare a Scribd company logo
OBJECT ORIENTED
PROGRAMMING
For the PeopleSoft
Developer
Lee Greffin ©
PROGRAMMING PARADIGMS
A list of programming paradigms is here:
https://en.wikipedia.org/wiki/Programming_paradigm
Programming paradigms that are common to PeopleSoft are:
• Structured
• Procedural
• Event-Driven
• Object Oriented
The members of the above list are examples of Imperative
programming.
STRUCTURED PROGRAMMING
Aims at improving clarity, quality and development time of programs.
Uses subroutines, block structures, and for and while loops.
Follows the 1966 discovery of the structured program theorem and
the publication of Edsger Dijkstra’s open letter “Go To Statement
Considered Harmful”.
The theorem states that a class of control flow graphs (historically
called charts in this context) can compute any computable function if
it combines subprograms in only three specific ways (control
structures)
1. Sequence
2. Selection
3. Iteration
STRUCTURED PROGRAMMING
ELEMENTS
Control Structures
1. Sequence: executing one subprogram, and then another
subprogram.
2. Selection: executing one of two subprograms according to the
value of a Boolean expression (if…then…else…endif).
3. Iteration: executing a subprogram until a Boolean expression is
true (while, for, do...until loops).
4. Recursion: a statement executes repeatedly calling itself until
termination conditions are met.
STRUCTURED PROGRAMMING
ELEMENTS
Subroutines
• Callable units such as procedures and functions that are used to
allow a sequence of code to be referred to by a single statement
Blocks
• Enables a group of statements to be treated as if they were one.
Syntax allows for enclosing the block structure in some way such as
bracketing with the use of BEGIN…END or the use of curly braces
{…}.
A PeopleSoft Example of a Structured Program is SQR.
SQR PROGRAM STRUCTURE
A SQR program consists of sections that are defined with BEGIN-
section and END-section commands.
The structure of a SQR program is typically:
• BEGIN-SETUP…END-SETUP
• BEGIN-HEADING…END-HEADING
• BEGIN-FOOTING…END-FOOTING
• BEGIN-PROGRAM…END-PROGRAM
Procedure sections are callable and follow a particular block syntax:
• BEGIN-PROCUEDURE {procedure_name}…END-PROCEDURE
PROCEDURAL PROGRAMMING
Derived from Structured programming.
Based on the concept of the procedure call. The focus of procedural
programming is to break down a programming task into a collection
of variables, data structures and subroutines.
Procedures/routines/subroutines/functions contain a series of
computational steps.
Any given procedure might be called at any point during a program’s
execution.
CPU’s provide support for procedural programming through a stack
register and instruction sets for calling procedures and returning
from them.
C, Fortran, Pascal, BASIC as well as PeopleSoft Application Engine are
IMPERATIVE PROGRAMMING
The developer writes code that describes in exacting detail the steps
that the computer must take to accomplish the goal.
Imperative programming focuses on describing how a program
operates.
Focus is on how to perform tasks and how to track changes in state.
State changes, order of execution are important.
The primary control flow is by use of loops, conditional statements
and function / method calls.
This is in contrast with declarative programming, which focuses on
what the program should accomplish without specifying how the
program achieves a result. SQL is an example of a declarative
language.
EVENT-DRIVEN PROGRAMMING
The flow of the program is determined by events:
• Mouse click / key press
• Messages (from other programs / threads)
Typically a main loop listens for events, and callback functions are
triggered when an event is triggered.
Event-driven programming is the dominant paradigm used in GUI
applications.
PeopleSoft PIA is an example of event-driven programming.
OBJECT ORIENTED WORKING
DEFINITION
Object Oriented Programming (OOP) is a programming paradigm
based on the concept of “objects”.
Those objects may contain:
• Data in the form of fields – often known as attributes
• Code in the form of procedures or methods
Most OOP languages are class-based, meaning that an object is an
instance of a class. The class also determines the type of the object.
OBJECT ORIENTED PROGRAMMING
FEATURES
Shared with procedural programming:
• Primitive (non-object type) variables
• Procedures – AKA functions, methods, routines, subroutines
Primitives in PeopleTools are called Conventional, and includes:
• Any
• Boolean
• Date / DateTime / Time
• Float / Integer / Number
• Object
• String
OBJECT ORIENTED PROGRAMMING
FEATURES
Unique to OOP:
• Classes and Objects
• Inheritance / Extensibility
• Dynamic dispatch
• Encapsulation
• Composition
• Delegation
• Polymorphism
OOP – CLASSES
A Class is the blueprint or plan or template that describes the details
of an Object.
A class defines data types, their initial values; the properties and the
methods of objects that are instantiated from it.
Classes support the object-oriented principles of abstraction,
encapsulation, polymorphism and reusability.
• Classes define data members and member functions
• Classes specify knowledge (attributes) - they know things - and
behavior (methods) - they do things.
ADVANTAGE OF CLASSES
Prior to Application classes, most PeopleCode functions were put into
FUNCLIB records.
However, in larger, more complex programs, it is sometimes difficult
to find (let alone maintain) a function. You could make every function
a class in a package with very little reworking of your PeopleCode.
Other advantages include:
• Easier to debug as all the pieces are separate.
• Easier to maintain because the functionality is gathered in one
place.
• Sub-classes can extend the properties and methods of an existing
class and add more (no need to clone!).
OOP - OBJECTS
In the class-based object-oriented programming paradigm, "object"
refers to a particular instance of a class where the object can be a
combination of variables, functions, and data structures.
An important distinction in programming languages is the difference
between an object-oriented language and an object-based language.
A language is usually considered object-based if it includes the basic
capabilities for an object: identity, properties, and attributes.
A language is considered object-oriented if it is object-based and
also has the capability of polymorphism and inheritance.
PeopleCode is an Object Oriented language.
OBJECTS IN PEOPLESOFT
A class is the blueprint for something, like a bicycle, a car, or a data
structure. An object is the actual thing that is built using that class
(or blueprint.)
From the blueprint for a bicycle, you can build a specific mountain
bike with 23 gears and tight suspension. From the blueprint of a data
structure class, you build a specific instance of that class.
Instantiation is the term for building that copy, or an instance, of a
class.
Declare:
• Local MY_NEGOTIATION:Amend:Utilities:AmendUtils &amendUtil;
Instantiate:
• &amendUtil = create
OOP – OBJECT BASED / OBJECT
ORIENTED
Object Based paradigms include the basic capabilities for an object:
• Identity
• Properties
• Attributes
A paradigm is considered Object Oriented if it has the above, then
includes:
• Polymorphism
• Inheritance
OOP - POLYMORPHISM
A definition: Polymorphism refers to a programming language's
ability to process objects differently depending on their data type or
class. More specifically, it is the ability to redefine methods for
derived classes.
Another: Polymorphism is the provision of a single interface to
entities of different types. A polymorphic type is one whose
operations can also be applied to values of some other type, or types.
A third: Polymorphism is an OOP concept which advocates the use of
a common interface instead of concrete implementation while writing
code.
OOP – TYPES OF POLYMORPHISM
Ad hoc polymorphism – also known as overloading. Not currently
available in Psoft.
Overloading is where two or more methods have the same name in a
class – but they have different variable types as parameters. Binding
is done during compile time.
Example:
Class myDateHandler(){
Method myDateMethod(&date as string);
Method myDateMethod(&date as date);
Method myDateMethod(&date as datetime);
… }
OOP – TYPES OF POLYMORPHISM
Parametric polymorphism – often known as generics. Again this is
not currently available in Psoft.
Generics are a way to make a language more expressive, while still
maintaining full static type-safety. Values can be handled identically
without depending on their type.
Generic programming centers around the idea of abstracting from
concrete, efficient algorithms to obtain generic algorithms that can be
combined with different data representations to produce a wide
variety of useful software. — Musser, David R.; Stepanov, Alexander
A., Generic Programming
Example (Java): public interface List<E> {
void add(E x);
Iterator<E> iterator(); }
OOP – TYPES OF POLYMORPHISM
Subtyping – many different classes are related by a common
superclass. Psoft DOES support this by the use of interfaces.
An interface class is purely a syntactic assist when you are defining
an application class which is totally composed of abstract methods
and properties.
An interface is used to specify the behavior of a class that implements
the interface. The class must provide at a minimum what’s in the
interface.
Methods are defined only – there are no bodies in an interface.
Think of it as a contract – a method that implements an interface
must have at a minimum everything specified in the interface.
OOP – INTERFACES EXAMPLE
interface Animal
method talk() returns string;
end-class;
/* First Implementation */
class Dog implements Animal
method talk() returns string;
end-class;
method talk
return “Woof!”;
end-method;
OOP - INTERFACES
/* Second Implementation */
class Cat implements Animal
method talk() returns string;
end-class;
method talk
return “Harrumph – no lasagna…”;
end-method;
Use:
&myDog.talk(); /* Returns “Woof!” */
&myCat.talk(); /* Returns “Harrumph – no lasagna…” */
OOP - INHERITANCE /
EXTENSIBILITY
Inheritance allows classes to be arranged in a hierarchy.
Represents a “is-a-type-of” relationship.
All the data and methods of the parent / Super class are available in
the child / Sub class.
The child / Sub class extends the capabilities of the parent (through
adding other methods and/or data).
Example: An Employee class might inherit from a Person class. The
Employee class may extend the Person class variables first_name and
last_name by providing a method GetFullName().
Person Employee
OOP - COMPOSITION
A class can contain a reference to another class.
Example: a method in an Employee class might contain a reference to
a method in the Address class.
This creates a strong “has a” relationship between the composite
(Employee) and the component (Address).
Composition enforces Encapsulation as the component parts are
members of the composite object.
AddressEmployee
-Employee
0..1
-Address
1..*
OOP – COMPOSITION OVER
INHERITANCE
This is a Gang of Four object-oriented technique.
• Clients remain unaware of the specific types of objects they use, as
long as the object adheres to the interface.
• Clients remain unaware of the classes that implement these objects;
clients only know about the abstract class(es) defining the interface.
The GoF refer to inheritance as white-box re-use; the internals of the
parent classes are exposed to the child classes.
Composition has black-box re-use; the internals are not exposed.
"Because inheritance exposes a subclass to details of its parent's
implementation, it's often said that 'inheritance breaks
encapsulation'". (Gang of Four 1995:19)
OOP - DYNAMIC DISPATCH
Dynamic dispatch is the process of selecting which implementation of
a polymorphic operation (method or function) to call at run time. It is
commonly employed in, and considered a prime characteristic of,
object-oriented programming (OOP) languages and systems.
Dynamic dispatch contrasts with static dispatch, in which the
implementation of a polymorphic operation is selected at compile-
time.
With dynamic dispatch, the name may be bound to a polymorphic
operation at compile time, but the implementation not be chosen
until run time.
Dynamic dispatch is key to how overloading/overriding work. Psoft
does not support either.
OOP - ENCAPSULATION
Encapsulation is an OOP concept that binds together the data and
functions that manipulate the data, and that keeps both safe from
outside interference and misuse. Data encapsulation led to the
important OOP concept of data hiding.
Encapsulation prevents external code from being concerned with the
internal workings of an object.
Encapsulation is a technique that encourages decoupling.
In PeopleSoft two keywords are important to this concept:
• Private
• Protected
OOP – PRIVATE & PROTECTED
Private - Use this keyword to declare any methods, constants, or
instance variables as private to the class, that is, they can't be
accessed by any other classes.
Protected - Use this keyword to declare any methods, constants, or
instance variables as protected to the class, that is, are only visible to
the declaring class and subclasses.
Public – The default. Visible to everything.
Rule of thumb: If other programmers use your class, you want to
ensure that errors from misuse cannot happen. Therefore use the
most restrictive access level that makes sense for a particular
member. Use private unless you have a good reason not to.
OOP - DELEGATION
Delegation refers to evaluating a member (property or method) of one
object (the receiver) in the context of another, original object (the
sender).
Delegation can be done explicitly, by passing the sending object to
the receiving object, which can be done in any object-oriented
language; or implicitly, by the member lookup rules of the language,
which requires language support for the feature.
Psoft only supports explicit delegation through use of the %this
keyword. Messages (calls) sent to the self (or this) variable in the
parent will "come back" to the object that originally received the
message.
OOP – CLASS DESIGN
CONSIDERATIONS
There are five basic principles of object-oriented design and
programming.
Following these principles makes it more likely that systems will be
easier to maintain and extend over time.
These principles help to remove code smells by providing a
framework through which code may be refactored.
The principles can be defined using the acronym SOLID.
OOP - SOLID
ADDITIONAL RESOURCES
The attached HTML file provides more information on the SOLID
principle as well links to various code smells.

More Related Content

PPTX
End-Stage Kidney Disease - Pathology - RDT
PPT
Chyluria and its Mangagement
PDF
Bladder carcinoma- surgery- substitution
PDF
Linux Internals - Part III
PPTX
IRON DEFICIENCY ANEMIA
PPTX
Mesothelial Hyperplasia
PPTX
Genetics in renal disorders
End-Stage Kidney Disease - Pathology - RDT
Chyluria and its Mangagement
Bladder carcinoma- surgery- substitution
Linux Internals - Part III
IRON DEFICIENCY ANEMIA
Mesothelial Hyperplasia
Genetics in renal disorders

What's hot (12)

PDF
Gu trauma- urethra- initial management
PPTX
Adrenal
PDF
Network Drivers
PDF
Urinary obstruction pathophysiology
PDF
Transitional urology 1
PPTX
Thrombin activable fibrinolysis inhibitor (tafi) role
PDF
Yocto Project : Custom Embedded Linux Distribution
PPT
Anatomy & neurovascular supply of the penis 1
PPTX
Bootloaders (U-Boot)
PPTX
Uml deployment diagram
PPTX
System Programming Unit III
PDF
BeagleBone Black Bootloaders
Gu trauma- urethra- initial management
Adrenal
Network Drivers
Urinary obstruction pathophysiology
Transitional urology 1
Thrombin activable fibrinolysis inhibitor (tafi) role
Yocto Project : Custom Embedded Linux Distribution
Anatomy & neurovascular supply of the penis 1
Bootloaders (U-Boot)
Uml deployment diagram
System Programming Unit III
BeagleBone Black Bootloaders
Ad

Similar to Object Oriented Programming Overview for the PeopleSoft Developer (20)

PPT
Unit 1- Basic concept of object-oriented-programming.ppt
PPTX
General oop concept
PDF
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
PPTX
Unit - I Intro. to OOP Concepts and Control Structure -OOP and CG (2024 Patte...
PPTX
Oop.pptx
PPTX
Object oriented programming in python
PPT
Share Unit 1- Basic concept of object-oriented-programming.ppt
PPTX
UNIT1-JAVA.pptx
PPTX
Different paradigms for problem solving.pptx
PPTX
SE-IT JAVA LAB OOP CONCEPT
PPTX
Unit 2.pptx
PPTX
Unit 2.pptx
PPT
Oop(object oriented programming)
PDF
JAVA-PPT'S.pdf
PDF
OOPS_Unit_1
PPTX
Software_Engineering_Presentation (1).pptx
PPTX
OOPs Java Module 1.pptx marketing trends social media company profilesmarketi...
PPTX
basics of c++ object oriented programming l anguage
PPTX
introduction to object oriented programming
PPTX
Object Oriented Program Class 12 Computer Science
Unit 1- Basic concept of object-oriented-programming.ppt
General oop concept
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
Unit - I Intro. to OOP Concepts and Control Structure -OOP and CG (2024 Patte...
Oop.pptx
Object oriented programming in python
Share Unit 1- Basic concept of object-oriented-programming.ppt
UNIT1-JAVA.pptx
Different paradigms for problem solving.pptx
SE-IT JAVA LAB OOP CONCEPT
Unit 2.pptx
Unit 2.pptx
Oop(object oriented programming)
JAVA-PPT'S.pdf
OOPS_Unit_1
Software_Engineering_Presentation (1).pptx
OOPs Java Module 1.pptx marketing trends social media company profilesmarketi...
basics of c++ object oriented programming l anguage
introduction to object oriented programming
Object Oriented Program Class 12 Computer Science
Ad

Recently uploaded (20)

PDF
medical staffing services at VALiNTRY
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
FLIGHT TICKET RESERVATION SYSTEM | FLIGHT BOOKING ENGINE API
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
top salesforce developer skills in 2025.pdf
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
ai tools demonstartion for schools and inter college
PPTX
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Build Multi-agent using Agent Development Kit
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
AI in Product Development-omnex systems
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Materi_Pemrograman_Komputer-Looping.pptx
PDF
How to Confidently Manage Project Budgets
PDF
Digital Strategies for Manufacturing Companies
PPTX
Transform Your Business with a Software ERP System
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
medical staffing services at VALiNTRY
How Creative Agencies Leverage Project Management Software.pdf
FLIGHT TICKET RESERVATION SYSTEM | FLIGHT BOOKING ENGINE API
2025 Textile ERP Trends: SAP, Odoo & Oracle
top salesforce developer skills in 2025.pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
ai tools demonstartion for schools and inter college
What to Capture When It Breaks: 16 Artifacts That Reveal Root Causes
Upgrade and Innovation Strategies for SAP ERP Customers
Build Multi-agent using Agent Development Kit
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
AI in Product Development-omnex systems
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Materi_Pemrograman_Komputer-Looping.pptx
How to Confidently Manage Project Budgets
Digital Strategies for Manufacturing Companies
Transform Your Business with a Software ERP System
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
ManageIQ - Sprint 268 Review - Slide Deck

Object Oriented Programming Overview for the PeopleSoft Developer

  • 1. OBJECT ORIENTED PROGRAMMING For the PeopleSoft Developer Lee Greffin ©
  • 2. PROGRAMMING PARADIGMS A list of programming paradigms is here: https://en.wikipedia.org/wiki/Programming_paradigm Programming paradigms that are common to PeopleSoft are: • Structured • Procedural • Event-Driven • Object Oriented The members of the above list are examples of Imperative programming.
  • 3. STRUCTURED PROGRAMMING Aims at improving clarity, quality and development time of programs. Uses subroutines, block structures, and for and while loops. Follows the 1966 discovery of the structured program theorem and the publication of Edsger Dijkstra’s open letter “Go To Statement Considered Harmful”. The theorem states that a class of control flow graphs (historically called charts in this context) can compute any computable function if it combines subprograms in only three specific ways (control structures) 1. Sequence 2. Selection 3. Iteration
  • 4. STRUCTURED PROGRAMMING ELEMENTS Control Structures 1. Sequence: executing one subprogram, and then another subprogram. 2. Selection: executing one of two subprograms according to the value of a Boolean expression (if…then…else…endif). 3. Iteration: executing a subprogram until a Boolean expression is true (while, for, do...until loops). 4. Recursion: a statement executes repeatedly calling itself until termination conditions are met.
  • 5. STRUCTURED PROGRAMMING ELEMENTS Subroutines • Callable units such as procedures and functions that are used to allow a sequence of code to be referred to by a single statement Blocks • Enables a group of statements to be treated as if they were one. Syntax allows for enclosing the block structure in some way such as bracketing with the use of BEGIN…END or the use of curly braces {…}. A PeopleSoft Example of a Structured Program is SQR.
  • 6. SQR PROGRAM STRUCTURE A SQR program consists of sections that are defined with BEGIN- section and END-section commands. The structure of a SQR program is typically: • BEGIN-SETUP…END-SETUP • BEGIN-HEADING…END-HEADING • BEGIN-FOOTING…END-FOOTING • BEGIN-PROGRAM…END-PROGRAM Procedure sections are callable and follow a particular block syntax: • BEGIN-PROCUEDURE {procedure_name}…END-PROCEDURE
  • 7. PROCEDURAL PROGRAMMING Derived from Structured programming. Based on the concept of the procedure call. The focus of procedural programming is to break down a programming task into a collection of variables, data structures and subroutines. Procedures/routines/subroutines/functions contain a series of computational steps. Any given procedure might be called at any point during a program’s execution. CPU’s provide support for procedural programming through a stack register and instruction sets for calling procedures and returning from them. C, Fortran, Pascal, BASIC as well as PeopleSoft Application Engine are
  • 8. IMPERATIVE PROGRAMMING The developer writes code that describes in exacting detail the steps that the computer must take to accomplish the goal. Imperative programming focuses on describing how a program operates. Focus is on how to perform tasks and how to track changes in state. State changes, order of execution are important. The primary control flow is by use of loops, conditional statements and function / method calls. This is in contrast with declarative programming, which focuses on what the program should accomplish without specifying how the program achieves a result. SQL is an example of a declarative language.
  • 9. EVENT-DRIVEN PROGRAMMING The flow of the program is determined by events: • Mouse click / key press • Messages (from other programs / threads) Typically a main loop listens for events, and callback functions are triggered when an event is triggered. Event-driven programming is the dominant paradigm used in GUI applications. PeopleSoft PIA is an example of event-driven programming.
  • 10. OBJECT ORIENTED WORKING DEFINITION Object Oriented Programming (OOP) is a programming paradigm based on the concept of “objects”. Those objects may contain: • Data in the form of fields – often known as attributes • Code in the form of procedures or methods Most OOP languages are class-based, meaning that an object is an instance of a class. The class also determines the type of the object.
  • 11. OBJECT ORIENTED PROGRAMMING FEATURES Shared with procedural programming: • Primitive (non-object type) variables • Procedures – AKA functions, methods, routines, subroutines Primitives in PeopleTools are called Conventional, and includes: • Any • Boolean • Date / DateTime / Time • Float / Integer / Number • Object • String
  • 12. OBJECT ORIENTED PROGRAMMING FEATURES Unique to OOP: • Classes and Objects • Inheritance / Extensibility • Dynamic dispatch • Encapsulation • Composition • Delegation • Polymorphism
  • 13. OOP – CLASSES A Class is the blueprint or plan or template that describes the details of an Object. A class defines data types, their initial values; the properties and the methods of objects that are instantiated from it. Classes support the object-oriented principles of abstraction, encapsulation, polymorphism and reusability. • Classes define data members and member functions • Classes specify knowledge (attributes) - they know things - and behavior (methods) - they do things.
  • 14. ADVANTAGE OF CLASSES Prior to Application classes, most PeopleCode functions were put into FUNCLIB records. However, in larger, more complex programs, it is sometimes difficult to find (let alone maintain) a function. You could make every function a class in a package with very little reworking of your PeopleCode. Other advantages include: • Easier to debug as all the pieces are separate. • Easier to maintain because the functionality is gathered in one place. • Sub-classes can extend the properties and methods of an existing class and add more (no need to clone!).
  • 15. OOP - OBJECTS In the class-based object-oriented programming paradigm, "object" refers to a particular instance of a class where the object can be a combination of variables, functions, and data structures. An important distinction in programming languages is the difference between an object-oriented language and an object-based language. A language is usually considered object-based if it includes the basic capabilities for an object: identity, properties, and attributes. A language is considered object-oriented if it is object-based and also has the capability of polymorphism and inheritance. PeopleCode is an Object Oriented language.
  • 16. OBJECTS IN PEOPLESOFT A class is the blueprint for something, like a bicycle, a car, or a data structure. An object is the actual thing that is built using that class (or blueprint.) From the blueprint for a bicycle, you can build a specific mountain bike with 23 gears and tight suspension. From the blueprint of a data structure class, you build a specific instance of that class. Instantiation is the term for building that copy, or an instance, of a class. Declare: • Local MY_NEGOTIATION:Amend:Utilities:AmendUtils &amendUtil; Instantiate: • &amendUtil = create
  • 17. OOP – OBJECT BASED / OBJECT ORIENTED Object Based paradigms include the basic capabilities for an object: • Identity • Properties • Attributes A paradigm is considered Object Oriented if it has the above, then includes: • Polymorphism • Inheritance
  • 18. OOP - POLYMORPHISM A definition: Polymorphism refers to a programming language's ability to process objects differently depending on their data type or class. More specifically, it is the ability to redefine methods for derived classes. Another: Polymorphism is the provision of a single interface to entities of different types. A polymorphic type is one whose operations can also be applied to values of some other type, or types. A third: Polymorphism is an OOP concept which advocates the use of a common interface instead of concrete implementation while writing code.
  • 19. OOP – TYPES OF POLYMORPHISM Ad hoc polymorphism – also known as overloading. Not currently available in Psoft. Overloading is where two or more methods have the same name in a class – but they have different variable types as parameters. Binding is done during compile time. Example: Class myDateHandler(){ Method myDateMethod(&date as string); Method myDateMethod(&date as date); Method myDateMethod(&date as datetime); … }
  • 20. OOP – TYPES OF POLYMORPHISM Parametric polymorphism – often known as generics. Again this is not currently available in Psoft. Generics are a way to make a language more expressive, while still maintaining full static type-safety. Values can be handled identically without depending on their type. Generic programming centers around the idea of abstracting from concrete, efficient algorithms to obtain generic algorithms that can be combined with different data representations to produce a wide variety of useful software. — Musser, David R.; Stepanov, Alexander A., Generic Programming Example (Java): public interface List<E> { void add(E x); Iterator<E> iterator(); }
  • 21. OOP – TYPES OF POLYMORPHISM Subtyping – many different classes are related by a common superclass. Psoft DOES support this by the use of interfaces. An interface class is purely a syntactic assist when you are defining an application class which is totally composed of abstract methods and properties. An interface is used to specify the behavior of a class that implements the interface. The class must provide at a minimum what’s in the interface. Methods are defined only – there are no bodies in an interface. Think of it as a contract – a method that implements an interface must have at a minimum everything specified in the interface.
  • 22. OOP – INTERFACES EXAMPLE interface Animal method talk() returns string; end-class; /* First Implementation */ class Dog implements Animal method talk() returns string; end-class; method talk return “Woof!”; end-method;
  • 23. OOP - INTERFACES /* Second Implementation */ class Cat implements Animal method talk() returns string; end-class; method talk return “Harrumph – no lasagna…”; end-method; Use: &myDog.talk(); /* Returns “Woof!” */ &myCat.talk(); /* Returns “Harrumph – no lasagna…” */
  • 24. OOP - INHERITANCE / EXTENSIBILITY Inheritance allows classes to be arranged in a hierarchy. Represents a “is-a-type-of” relationship. All the data and methods of the parent / Super class are available in the child / Sub class. The child / Sub class extends the capabilities of the parent (through adding other methods and/or data). Example: An Employee class might inherit from a Person class. The Employee class may extend the Person class variables first_name and last_name by providing a method GetFullName(). Person Employee
  • 25. OOP - COMPOSITION A class can contain a reference to another class. Example: a method in an Employee class might contain a reference to a method in the Address class. This creates a strong “has a” relationship between the composite (Employee) and the component (Address). Composition enforces Encapsulation as the component parts are members of the composite object. AddressEmployee -Employee 0..1 -Address 1..*
  • 26. OOP – COMPOSITION OVER INHERITANCE This is a Gang of Four object-oriented technique. • Clients remain unaware of the specific types of objects they use, as long as the object adheres to the interface. • Clients remain unaware of the classes that implement these objects; clients only know about the abstract class(es) defining the interface. The GoF refer to inheritance as white-box re-use; the internals of the parent classes are exposed to the child classes. Composition has black-box re-use; the internals are not exposed. "Because inheritance exposes a subclass to details of its parent's implementation, it's often said that 'inheritance breaks encapsulation'". (Gang of Four 1995:19)
  • 27. OOP - DYNAMIC DISPATCH Dynamic dispatch is the process of selecting which implementation of a polymorphic operation (method or function) to call at run time. It is commonly employed in, and considered a prime characteristic of, object-oriented programming (OOP) languages and systems. Dynamic dispatch contrasts with static dispatch, in which the implementation of a polymorphic operation is selected at compile- time. With dynamic dispatch, the name may be bound to a polymorphic operation at compile time, but the implementation not be chosen until run time. Dynamic dispatch is key to how overloading/overriding work. Psoft does not support either.
  • 28. OOP - ENCAPSULATION Encapsulation is an OOP concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse. Data encapsulation led to the important OOP concept of data hiding. Encapsulation prevents external code from being concerned with the internal workings of an object. Encapsulation is a technique that encourages decoupling. In PeopleSoft two keywords are important to this concept: • Private • Protected
  • 29. OOP – PRIVATE & PROTECTED Private - Use this keyword to declare any methods, constants, or instance variables as private to the class, that is, they can't be accessed by any other classes. Protected - Use this keyword to declare any methods, constants, or instance variables as protected to the class, that is, are only visible to the declaring class and subclasses. Public – The default. Visible to everything. Rule of thumb: If other programmers use your class, you want to ensure that errors from misuse cannot happen. Therefore use the most restrictive access level that makes sense for a particular member. Use private unless you have a good reason not to.
  • 30. OOP - DELEGATION Delegation refers to evaluating a member (property or method) of one object (the receiver) in the context of another, original object (the sender). Delegation can be done explicitly, by passing the sending object to the receiving object, which can be done in any object-oriented language; or implicitly, by the member lookup rules of the language, which requires language support for the feature. Psoft only supports explicit delegation through use of the %this keyword. Messages (calls) sent to the self (or this) variable in the parent will "come back" to the object that originally received the message.
  • 31. OOP – CLASS DESIGN CONSIDERATIONS There are five basic principles of object-oriented design and programming. Following these principles makes it more likely that systems will be easier to maintain and extend over time. These principles help to remove code smells by providing a framework through which code may be refactored. The principles can be defined using the acronym SOLID.
  • 33. ADDITIONAL RESOURCES The attached HTML file provides more information on the SOLID principle as well links to various code smells.

Editor's Notes

  • #3: https://en.wikipedia.org/wiki/Structured_programming
  • #4: https://en.wikipedia.org/wiki/Structured_programming
  • #8: https://en.wikipedia.org/wiki/Procedural_programming A stack register is a computer central processor register whose purpose is to keep track of a call stack. On an accumulator-based architecture machine, this may be a dedicated register such as SP on an Intel x86 machine. https://en.wikipedia.org/wiki/Stack_register
  • #9: https://en.wikipedia.org/wiki/Imperative_programming https://msdn.microsoft.com/en-us/library/mt693186.aspx
  • #10: https://en.wikipedia.org/wiki/Event-driven_programming
  • #12: http://docs.oracle.com/cd/E41633_01/pt853pbh1/eng/pt/tpcd/concept_DataTypes-074b53.html#ObjectDataTypes-074b50 https://en.wikipedia.org/wiki/Primitive_data_type
  • #14: https://en.wikipedia.org/wiki/Class_(computer_programming)
  • #15: http://docs.oracle.com/cd/E41633_01/pt853pbh1/eng/pt/tpcr/concept_UnderstandingApplicationClasses-0716e2.html
  • #16: https://en.wikipedia.org/wiki/Object_(computer_science) http://psftpp.blogspot.com/2009/07/peoplesofts-metadata-api.html %metadata is a PeopleTools Proprietary API that gives access to the ‘baked in’ PeopleTools classes. Example: PTIB_PACKAGE.Main;
  • #17: http://docs.oracle.com/cd/E41633_01/pt853pbh1/eng/pt/tpcd/concept_ClassesandObjects-074b14.html
  • #18: Polymorphism and Inheritance are covered in the next slides.
  • #19: http://www.webopedia.com/TERM/P/polymorphism.html https://en.wikipedia.org/wiki/Polymorphism_(computer_science) http://javarevisited.blogspot.com/2011/08/what-is-polymorphism-in-java-example.html This is probably the hardest concept to define but it’s easy to use and demonstrate.
  • #20: https://en.wikipedia.org/wiki/Polymorphism_(computer_science) This is commonly used in Java – and since Psoft does not ‘understand’ it, calling a Java object that uses overloading may cause errors.
  • #21: https://en.wikipedia.org/wiki/Parametric_polymorphism https://en.wikipedia.org/wiki/Generics_in_Java https://en.wikipedia.org/wiki/Generic_programming In the example note the keyword interface; also the use of the <> brackets; also the <E> is NOT typed. Generics are common in C++, Java, C#,
  • #22: http://docs.oracle.com/cd/E41633_01/pt853pbh1/eng/pt/tpcr/task_ApplicationClassesGeneralStructure-0716e0.html
  • #23: Note: The alternate way of creating an interface is: class Animal method talk() returns string abstract; end-class; Both are correct – with the keyword interface the Psoft compiler understands that the methods are abstract and will not have bodies. If neither are used – keyword abstract or interface – the compiler will throw an error as there is no method provided past it’s declaration.
  • #25: https://en.wikipedia.org/wiki/Object-oriented_programming UML from Visio Languages that support classes almost always support inheritance. This allows classes to be arranged in a hierarchy that represents "is-a-type-of" relationships. For example, class Employee might inherit from class Person. All the data and methods available to the parent class also appear in the child class with the same names. For example, class Person might define variables "first_name" and "last_name" with method "make_full_name()". These will also be available in class Employee, which might add the variables "position" and "salary". This technique allows easy re-use of the same procedures and data definitions, in addition to potentially mirroring real-world relationships in an intuitive way. Rather than utilizing database tables and programming subroutines, the developer utilizes objects the user may be more familiar with: objects from their application domain.[8] Subclasses can override the methods defined by superclasses. Multiple inheritance is allowed in some languages, though this can make resolving overrides complicated. Some languages have special support for mixins, though in any language with multiple inheritance, a mixin is simply a class that does not represent an is-a-type-of relationship. Mixins are typically used to add the same methods to multiple classes. For example, class UnicodeConversionMixin might provide a method unicode_to_ascii() when included in class FileReader and class WebPageScraper, which don't share a common parent.
  • #26: https://en.wikipedia.org/wiki/Object_composition UML from Visio Composition is depicted as a filled diamond and a solid line. Composition is a kind of association where the composite object has sole responsibility for the disposition of the component parts. The relationship between the composite and the component is a strong “has a” relationship, as the composite object takes ownership of the component. This means the composite is responsible for the creation and destruction of the component parts. An object may only be part of one composite. If the composite object is destroyed, all the component parts must be destroyed. The part has no life of itself and cannot be transferred to another object. Composition enforces encapsulation as the component parts usually are members of the composite object.
  • #27: https://en.wikipedia.org/wiki/Design_Patterns Gang of Four: Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides – with Grady Booch as a contributor . Design Patterns: Elements of Reusable Object-Oriented Software ISBN0-201-63361-2 https://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612/ref=sr_1_1?ie=UTF8&qid=1479493496&sr=8-1&keywords=design+patterns+elements+of+reusable+object-oriented+software
  • #28: https://en.wikipedia.org/wiki/Dynamic_dispatch
  • #29: https://en.wikipedia.org/wiki/Object-oriented_programming#Encapsulation
  • #31: https://en.wikipedia.org/wiki/Delegation_(object-oriented_programming)
  • #32: https://en.wikipedia.org/wiki/SOLID_(object-oriented_design)