SlideShare a Scribd company logo
THINKING IN OBJECT-
ORIENTED
Sadad PSP, IT Dept
Winter-Spring 2019
PARADIGMS
A paradigm is a theory or a group of ideas about how something
should be done, made, or thought about.
FOOD SHORTAGE
: Enacting some laws to provide food to the hungry people
: Offer some money/food to help those hungry people
: Preach to them to work and make livings for themselves or appeal to
rich people to donate food to the hungry people
SOLUTION MUST BE PRACTICAL
AND EFFECTIVE
PROGRAMMING PARADIGM
DEFINITION
A programming paradigm is a way of conceptualizing what it means
to perform computation, and how tasks that are to be carried out on
a computer should be structured and organized
PROGRAMMING PARADIGM
Programming paradigm involving viewing the solution to a problem
by combining and in different ways.
Programming
Paradigms
Imperative
Procedural
Declarative
Functional
Logic
Object-
Oriented
IMPERATIVE (ALGORITHMIC)
PARADIGM
Programming with an explicit sequence of commands that update
state
int num = 15; // num holds 15 at this point
int counter = 0; // counter holds 0 at this point
while(counter < 10) {
num = num + 1; // Modifying data in num
counter = counter + 1; // Modifying data in counter
}
// num holds 25 at this point
PROCEDURAL PARADIGM
Similar to the imperative paradigm with one difference: it combines
multiple commands in a unit called a procedure
Increases reusability of algorithms
void addTen(int num) {
int counter = 0;
while(counter < 10) {
num = num + 1; // Modifying data in num
counter = counter + 1; // Modifying data in counter
}
// num has been incremented by 10
}
/*************************************Client Code******************************************************/
int x = 15; // x holds 15 at this point
addTen(x); // Call addTen procedure that will increment x by 10
// x holds 25 at this point
DECLARATIVE PROGRAMMING
Programming by specifying the result you want, not to get
it.
select upper(name)
from people
where length(name) > 5
order by name
FUNCTIONAL (APPLICATIVE)
PARADIGM
Programming with function calls that avoid any global state.
values are immutable
int add(x, n) {
if (n == 0) {
return x;
}
else {
return 1 + add(x, n-1); // Apply add function recursively
}
}
add(15, 10); // Results in 25
LOGIC PARADIGM
 Programming by specifying a set of facts and rules. An engine infers the answers
to questions.(Rule-based)
Programming by specifying a set of constraints. An engine finds the values that
meet the constraints.
 In the logic paradigm, a program consists of a set of axioms and a goal
statement. The set of axioms is the collection of facts and inference rules that
make up a theory
PersonNationality = {{John, American}, {Li, Chinese}, {Ravi, Indian}}
/***********************************client code***************************************************/
PersonNationality(?, Chinese)
OBJECT ORIENTED PARADIGM
A very powerful paradigm for modeling real-world
phenomena in a computational model
CLASS
public class Person {
private String name, gender;
public Person(String initialName, String initialGender) {
name = initialName;
gender = initialGender;
}
public String getName() {
return name;
}
public void setName(String newName) {
name = newName;
}
public String getGender() {
return gender;
}
}
OBJECT ORIENTED PRINCIPAL
1.Abstraction
2.Encapsulation and Information Hiding
3.Inheritance
4.Polymorphism
DECOMPOSITION
Simplicity
Isolation
Maintainability
1. ABSTRACTION
Abstraction is a way to perform decomposition of a problem by focusing on
relevant details and ignoring the irrelevant details about it in a particular
context:
 Procedural abstraction
 Data abstraction
PROCEDURAL ABSTRACTION
: We seek generality by allowing the
same mechanism to be adapted to many different contexts by
providing it with information on that context
: We ignore the implementation details,
and agree to treat as acceptable any implementation that adheres to
the specification
ABSTRACTION BY
PARAMETERIZATION
Rather than independently creating separate methods for Males and
Females, we may create a method that is called
CountPopulationOfSex that takes a parameter that specifies the sex
of interest
ABSTRACTION BY SPECIFICATION
public static int getRangeSum(int lowerLimit, int
upperLimit) {
int sum = 0;
int counter = lowerLimit;
while(counter <= upperLimit) {
sum = sum + counter;
counter = counter + 1;
}
return sum;
}
public static int getRangeSum(int lowerLimit, int
upperLimit) {
int n = upperLimit - lowerLimit + 1;
int sum = n * (2 * lowerLimit + (n-1))/2;
return sum;
}
DATA ABSTRACTION
Data abstraction lets programmers create a new data type called an
abstract data type (ADT)
public class Person {
private String[] data = new String[2];
public Person(String initialName, String initialGender) {
data[0] = initialName;
data[1] = initialGender;
}
public String getName() {
return data[0];
}
public void setName(String newName) {
data[0] = newName;
}
public String getGender() {
return data[1];
}
}
public class Person {
private String name, gender;
public Person(String initialName, String initialGender) {
name = initialName;
gender = initialGender;
}
public String getName() {
return name;
}
public void setName(String newName) {
name = newName;
}
public String getGender() {
return gender;
}
}
2. ENCAPSULATION AND
INFORMATION HIDINGEncapsulation is simply the bundling of items together into one entity.
Information hiding is the process of hiding implementation details that
are likely to change.
ENCAPSULATION, ABSTRACTION, AND
INFORMATION HIDING ARE THREE
SEPARATE CONCEPTS
is only concerned about which item should be hidden. What
should (not) be hidden (or ignored) is the concern of abstraction.
is bundling of data and operations on the data into an
entity called a class and is not concerned with whether the items that are
bundled in an entity are hidden from other modules in the application or
not.
is concerned with how an
item is hidden
3. INHERITANCE
 The inheritance mechanism lets you define a new abstraction by extending
an existing abstraction
Inheritance allows you to use varying degrees of abstraction at different
levels of hierarchy
Inheritance is also used as a technique to implement polymorphism
MULTIPLE INHERITANCE
Multiple Inheritance is a feature where a class can inherit from more
than one classes
MULTIPLE INHERITANCE PROBLEM
Name ambiguity
Inherited, different features can have the same name
Same feature may be inherited several times
Impact on substitutability
Parent constructor calling in diamond problem
Ambiguity in calling method has override in supper classes but
not in descendent class
Overriding a method that has been inherited from several
supper classes
Increase Complexity

More Related Content

What's hot

USE OF ADAPTIVE COLOURED PETRI NETWORK IN SUPPORT OF DECISIONMAKING
USE OF ADAPTIVE COLOURED PETRI NETWORK IN SUPPORT OF DECISIONMAKINGUSE OF ADAPTIVE COLOURED PETRI NETWORK IN SUPPORT OF DECISIONMAKING
USE OF ADAPTIVE COLOURED PETRI NETWORK IN SUPPORT OF DECISIONMAKING
csandit
 
Integration of function on non standard form
Integration of function on non standard formIntegration of function on non standard form
Integration of function on non standard form
Lily Maryati
 
On fuzzy concepts in engineering ppt. ncce
On fuzzy concepts in engineering ppt. ncceOn fuzzy concepts in engineering ppt. ncce
On fuzzy concepts in engineering ppt. ncceSurender Singh
 
17 Machine Learning Radial Basis Functions
17 Machine Learning Radial Basis Functions17 Machine Learning Radial Basis Functions
17 Machine Learning Radial Basis Functions
Andres Mendez-Vazquez
 
Fuzzy logic systems
Fuzzy logic systemsFuzzy logic systems
Fuzzy logic systemsPham Tung
 
Machine learning session9(clustering)
Machine learning   session9(clustering)Machine learning   session9(clustering)
Machine learning session9(clustering)
Abhimanyu Dwivedi
 
Data Structure
Data StructureData Structure
Data Structuresheraz1
 
Data Science - Part IX - Support Vector Machine
Data Science - Part IX -  Support Vector MachineData Science - Part IX -  Support Vector Machine
Data Science - Part IX - Support Vector Machine
Derek Kane
 
Lesson 21. Pattern 13. Data alignment
Lesson 21. Pattern 13. Data alignmentLesson 21. Pattern 13. Data alignment
Lesson 21. Pattern 13. Data alignment
PVS-Studio
 
Intelligent Control and Fuzzy Logic
Intelligent Control and Fuzzy LogicIntelligent Control and Fuzzy Logic
Intelligent Control and Fuzzy LogicPraneel Chand
 
Operations of functions
Operations of functionsOperations of functions
Operations of functions
REYEMMANUELILUMBA
 
Intelligence control using fuzzy logic
Intelligence control using fuzzy logicIntelligence control using fuzzy logic
Intelligence control using fuzzy logic
elakiyakishok
 
OO design principles and patterns
OO design principles and patternsOO design principles and patterns
OO design principles and patterns
Paulo Gandra de Sousa
 
Chapter3 hundred page machine learning
Chapter3 hundred page machine learningChapter3 hundred page machine learning
Chapter3 hundred page machine learning
mustafa sarac
 
20 Simple CART
20 Simple CART20 Simple CART
20 Simple CART
Vishal Dutt
 
Fuzzy logic
Fuzzy logicFuzzy logic
Fuzzy logic
Babu Appat
 

What's hot (20)

Lesson 36
Lesson 36Lesson 36
Lesson 36
 
USE OF ADAPTIVE COLOURED PETRI NETWORK IN SUPPORT OF DECISIONMAKING
USE OF ADAPTIVE COLOURED PETRI NETWORK IN SUPPORT OF DECISIONMAKINGUSE OF ADAPTIVE COLOURED PETRI NETWORK IN SUPPORT OF DECISIONMAKING
USE OF ADAPTIVE COLOURED PETRI NETWORK IN SUPPORT OF DECISIONMAKING
 
Integration of function on non standard form
Integration of function on non standard formIntegration of function on non standard form
Integration of function on non standard form
 
On fuzzy concepts in engineering ppt. ncce
On fuzzy concepts in engineering ppt. ncceOn fuzzy concepts in engineering ppt. ncce
On fuzzy concepts in engineering ppt. ncce
 
025 chapter iv
025 chapter iv025 chapter iv
025 chapter iv
 
17 Machine Learning Radial Basis Functions
17 Machine Learning Radial Basis Functions17 Machine Learning Radial Basis Functions
17 Machine Learning Radial Basis Functions
 
Calc 4.4a
Calc 4.4aCalc 4.4a
Calc 4.4a
 
Fuzzy logic systems
Fuzzy logic systemsFuzzy logic systems
Fuzzy logic systems
 
Machine learning session9(clustering)
Machine learning   session9(clustering)Machine learning   session9(clustering)
Machine learning session9(clustering)
 
Chapitre 08
Chapitre 08Chapitre 08
Chapitre 08
 
Data Structure
Data StructureData Structure
Data Structure
 
Data Science - Part IX - Support Vector Machine
Data Science - Part IX -  Support Vector MachineData Science - Part IX -  Support Vector Machine
Data Science - Part IX - Support Vector Machine
 
Lesson 21. Pattern 13. Data alignment
Lesson 21. Pattern 13. Data alignmentLesson 21. Pattern 13. Data alignment
Lesson 21. Pattern 13. Data alignment
 
Intelligent Control and Fuzzy Logic
Intelligent Control and Fuzzy LogicIntelligent Control and Fuzzy Logic
Intelligent Control and Fuzzy Logic
 
Operations of functions
Operations of functionsOperations of functions
Operations of functions
 
Intelligence control using fuzzy logic
Intelligence control using fuzzy logicIntelligence control using fuzzy logic
Intelligence control using fuzzy logic
 
OO design principles and patterns
OO design principles and patternsOO design principles and patterns
OO design principles and patterns
 
Chapter3 hundred page machine learning
Chapter3 hundred page machine learningChapter3 hundred page machine learning
Chapter3 hundred page machine learning
 
20 Simple CART
20 Simple CART20 Simple CART
20 Simple CART
 
Fuzzy logic
Fuzzy logicFuzzy logic
Fuzzy logic
 

Similar to Thinking in object oriented - Part 1

Data structures using C
Data structures using CData structures using C
Data structures using C
Pdr Patnaik
 
Ds12 140715025807-phpapp02
Ds12 140715025807-phpapp02Ds12 140715025807-phpapp02
Ds12 140715025807-phpapp02
Salman Qamar
 
VCE Unit 01 (1).pptx
VCE Unit 01 (1).pptxVCE Unit 01 (1).pptx
VCE Unit 01 (1).pptx
skilljiolms
 
software design principles
software design principlessoftware design principles
software design principles
Cristal Ngo
 
Object Oriented Programming Short Notes for Preperation of Exams
Object Oriented Programming Short Notes for Preperation of ExamsObject Oriented Programming Short Notes for Preperation of Exams
Object Oriented Programming Short Notes for Preperation of Exams
MuhammadTalha436
 
DATA STRUCTURE AND ALGORITHM FULL NOTES
DATA STRUCTURE AND ALGORITHM FULL NOTESDATA STRUCTURE AND ALGORITHM FULL NOTES
DATA STRUCTURE AND ALGORITHM FULL NOTES
Aniruddha Paul
 
Behavioral pattern 4
Behavioral pattern 4Behavioral pattern 4
Behavioral pattern 4
Naga Muruga
 
Lec 1 Ds
Lec 1 DsLec 1 Ds
Lec 1 DsQundeel
 
Lec 1 Ds
Lec 1 DsLec 1 Ds
Lec 1 DsQundeel
 
Output Privacy Protection With Pattern-Based Heuristic Algorithm
Output Privacy Protection With Pattern-Based Heuristic AlgorithmOutput Privacy Protection With Pattern-Based Heuristic Algorithm
Output Privacy Protection With Pattern-Based Heuristic Algorithm
ijcsit
 
Principal of objected oriented programming
Principal of objected oriented programming Principal of objected oriented programming
Principal of objected oriented programming
Rokonuzzaman Rony
 
Jcl interview questions
Jcl interview questionsJcl interview questions
Jcl interview questionsganjigirish
 
OOPJ.pptx
OOPJ.pptxOOPJ.pptx
OOPJ.pptx
ssuser99ca78
 
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
ijcseit
 
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
IJCSES Journal
 
Premature optimisation workshop
Premature optimisation workshopPremature optimisation workshop
Premature optimisation workshop
Arjan van Leeuwen
 
Unit 1
Unit  1Unit  1
Unit 1
donny101
 
9. DBMS Experiment Laboratory PresentationPPT
9. DBMS Experiment Laboratory PresentationPPT9. DBMS Experiment Laboratory PresentationPPT
9. DBMS Experiment Laboratory PresentationPPT
TheVerse1
 
CSc investigatory project
CSc investigatory projectCSc investigatory project
CSc investigatory project
DIVYANSHU KUMAR
 

Similar to Thinking in object oriented - Part 1 (20)

Data structures using C
Data structures using CData structures using C
Data structures using C
 
Ds12 140715025807-phpapp02
Ds12 140715025807-phpapp02Ds12 140715025807-phpapp02
Ds12 140715025807-phpapp02
 
VCE Unit 01 (1).pptx
VCE Unit 01 (1).pptxVCE Unit 01 (1).pptx
VCE Unit 01 (1).pptx
 
software design principles
software design principlessoftware design principles
software design principles
 
Object Oriented Programming Short Notes for Preperation of Exams
Object Oriented Programming Short Notes for Preperation of ExamsObject Oriented Programming Short Notes for Preperation of Exams
Object Oriented Programming Short Notes for Preperation of Exams
 
DATA STRUCTURE AND ALGORITHM FULL NOTES
DATA STRUCTURE AND ALGORITHM FULL NOTESDATA STRUCTURE AND ALGORITHM FULL NOTES
DATA STRUCTURE AND ALGORITHM FULL NOTES
 
Behavioral pattern 4
Behavioral pattern 4Behavioral pattern 4
Behavioral pattern 4
 
Lec 1 Ds
Lec 1 DsLec 1 Ds
Lec 1 Ds
 
Lec 1 Ds
Lec 1 DsLec 1 Ds
Lec 1 Ds
 
Output Privacy Protection With Pattern-Based Heuristic Algorithm
Output Privacy Protection With Pattern-Based Heuristic AlgorithmOutput Privacy Protection With Pattern-Based Heuristic Algorithm
Output Privacy Protection With Pattern-Based Heuristic Algorithm
 
Principal of objected oriented programming
Principal of objected oriented programming Principal of objected oriented programming
Principal of objected oriented programming
 
Jcl interview questions
Jcl interview questionsJcl interview questions
Jcl interview questions
 
OOPJ.pptx
OOPJ.pptxOOPJ.pptx
OOPJ.pptx
 
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
 
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
THE IMPLICATION OF STATISTICAL ANALYSIS AND FEATURE ENGINEERING FOR MODEL BUI...
 
Premature optimisation workshop
Premature optimisation workshopPremature optimisation workshop
Premature optimisation workshop
 
Clean code
Clean codeClean code
Clean code
 
Unit 1
Unit  1Unit  1
Unit 1
 
9. DBMS Experiment Laboratory PresentationPPT
9. DBMS Experiment Laboratory PresentationPPT9. DBMS Experiment Laboratory PresentationPPT
9. DBMS Experiment Laboratory PresentationPPT
 
CSc investigatory project
CSc investigatory projectCSc investigatory project
CSc investigatory project
 

Recently uploaded

APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
Boni García
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
Roshan Dwivedi
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 

Recently uploaded (20)

APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)APIs for Browser Automation (MoT Meetup 2024)
APIs for Browser Automation (MoT Meetup 2024)
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Launch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in MinutesLaunch Your Streaming Platforms in Minutes
Launch Your Streaming Platforms in Minutes
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 

Thinking in object oriented - Part 1

  • 1. THINKING IN OBJECT- ORIENTED Sadad PSP, IT Dept Winter-Spring 2019
  • 2. PARADIGMS A paradigm is a theory or a group of ideas about how something should be done, made, or thought about.
  • 3. FOOD SHORTAGE : Enacting some laws to provide food to the hungry people : Offer some money/food to help those hungry people : Preach to them to work and make livings for themselves or appeal to rich people to donate food to the hungry people
  • 4. SOLUTION MUST BE PRACTICAL AND EFFECTIVE
  • 5. PROGRAMMING PARADIGM DEFINITION A programming paradigm is a way of conceptualizing what it means to perform computation, and how tasks that are to be carried out on a computer should be structured and organized
  • 6. PROGRAMMING PARADIGM Programming paradigm involving viewing the solution to a problem by combining and in different ways.
  • 8. IMPERATIVE (ALGORITHMIC) PARADIGM Programming with an explicit sequence of commands that update state int num = 15; // num holds 15 at this point int counter = 0; // counter holds 0 at this point while(counter < 10) { num = num + 1; // Modifying data in num counter = counter + 1; // Modifying data in counter } // num holds 25 at this point
  • 9. PROCEDURAL PARADIGM Similar to the imperative paradigm with one difference: it combines multiple commands in a unit called a procedure Increases reusability of algorithms void addTen(int num) { int counter = 0; while(counter < 10) { num = num + 1; // Modifying data in num counter = counter + 1; // Modifying data in counter } // num has been incremented by 10 } /*************************************Client Code******************************************************/ int x = 15; // x holds 15 at this point addTen(x); // Call addTen procedure that will increment x by 10 // x holds 25 at this point
  • 10. DECLARATIVE PROGRAMMING Programming by specifying the result you want, not to get it. select upper(name) from people where length(name) > 5 order by name
  • 11. FUNCTIONAL (APPLICATIVE) PARADIGM Programming with function calls that avoid any global state. values are immutable int add(x, n) { if (n == 0) { return x; } else { return 1 + add(x, n-1); // Apply add function recursively } } add(15, 10); // Results in 25
  • 12. LOGIC PARADIGM  Programming by specifying a set of facts and rules. An engine infers the answers to questions.(Rule-based) Programming by specifying a set of constraints. An engine finds the values that meet the constraints.  In the logic paradigm, a program consists of a set of axioms and a goal statement. The set of axioms is the collection of facts and inference rules that make up a theory PersonNationality = {{John, American}, {Li, Chinese}, {Ravi, Indian}} /***********************************client code***************************************************/ PersonNationality(?, Chinese)
  • 13. OBJECT ORIENTED PARADIGM A very powerful paradigm for modeling real-world phenomena in a computational model
  • 14. CLASS public class Person { private String name, gender; public Person(String initialName, String initialGender) { name = initialName; gender = initialGender; } public String getName() { return name; } public void setName(String newName) { name = newName; } public String getGender() { return gender; } }
  • 15. OBJECT ORIENTED PRINCIPAL 1.Abstraction 2.Encapsulation and Information Hiding 3.Inheritance 4.Polymorphism
  • 17. 1. ABSTRACTION Abstraction is a way to perform decomposition of a problem by focusing on relevant details and ignoring the irrelevant details about it in a particular context:  Procedural abstraction  Data abstraction
  • 18. PROCEDURAL ABSTRACTION : We seek generality by allowing the same mechanism to be adapted to many different contexts by providing it with information on that context : We ignore the implementation details, and agree to treat as acceptable any implementation that adheres to the specification
  • 19. ABSTRACTION BY PARAMETERIZATION Rather than independently creating separate methods for Males and Females, we may create a method that is called CountPopulationOfSex that takes a parameter that specifies the sex of interest
  • 20. ABSTRACTION BY SPECIFICATION public static int getRangeSum(int lowerLimit, int upperLimit) { int sum = 0; int counter = lowerLimit; while(counter <= upperLimit) { sum = sum + counter; counter = counter + 1; } return sum; } public static int getRangeSum(int lowerLimit, int upperLimit) { int n = upperLimit - lowerLimit + 1; int sum = n * (2 * lowerLimit + (n-1))/2; return sum; }
  • 21. DATA ABSTRACTION Data abstraction lets programmers create a new data type called an abstract data type (ADT) public class Person { private String[] data = new String[2]; public Person(String initialName, String initialGender) { data[0] = initialName; data[1] = initialGender; } public String getName() { return data[0]; } public void setName(String newName) { data[0] = newName; } public String getGender() { return data[1]; } } public class Person { private String name, gender; public Person(String initialName, String initialGender) { name = initialName; gender = initialGender; } public String getName() { return name; } public void setName(String newName) { name = newName; } public String getGender() { return gender; } }
  • 22. 2. ENCAPSULATION AND INFORMATION HIDINGEncapsulation is simply the bundling of items together into one entity. Information hiding is the process of hiding implementation details that are likely to change.
  • 23. ENCAPSULATION, ABSTRACTION, AND INFORMATION HIDING ARE THREE SEPARATE CONCEPTS is only concerned about which item should be hidden. What should (not) be hidden (or ignored) is the concern of abstraction. is bundling of data and operations on the data into an entity called a class and is not concerned with whether the items that are bundled in an entity are hidden from other modules in the application or not. is concerned with how an item is hidden
  • 24. 3. INHERITANCE  The inheritance mechanism lets you define a new abstraction by extending an existing abstraction Inheritance allows you to use varying degrees of abstraction at different levels of hierarchy Inheritance is also used as a technique to implement polymorphism
  • 25. MULTIPLE INHERITANCE Multiple Inheritance is a feature where a class can inherit from more than one classes
  • 26. MULTIPLE INHERITANCE PROBLEM Name ambiguity Inherited, different features can have the same name Same feature may be inherited several times Impact on substitutability Parent constructor calling in diamond problem Ambiguity in calling method has override in supper classes but not in descendent class Overriding a method that has been inherited from several supper classes Increase Complexity

Editor's Notes

  1. Programming Language may provide features that make it suitable for programming using one programming paradigm and not the other.
  2. Programs has two component: 1) data 2) algorithms An algorithms is set of steps that operates on data to arrive a solution to a problem.
  3. Control flow in imperative programming is explicit: commands show how the computation takes place, step by step. Each step affects the global state of the computation FORTRAN, COBOL, and C
  4. C, C++, Java, and COBOL
  5. In the imperative paradigm, we are concerned about the “how” part of the problem. In the declarative paradigm, we are concerned about the “what” part of the problem
  6. In functional programming, control flow is expressed by combining function calls, rather than by assigning values to variables based on the concept of mathematical functions In functional programming, a repeated task is performed using recursion Haskell, Erlang, and Scala
  7. The primary task of the programmer is to describe the problem as closely as possible Prolog
  8. Hiding internal details and showing functionality is known as abstraction
  9. Multiple interface inheritance in java and c#