SlideShare a Scribd company logo
UNIT II
Object based Programming
Procedural Programming
◦sequence of things
◦Emphasis is on doing things i.e. procedures.
◦share global data
◦top-down approach
Modular Programming
◦Emphasizes separating the functionality
◦modules perform logically discrete functions.
◦no interaction between modules.
◦Each module works independently
Generic Programming
◦Generic programming is about generalizing software components.
◦Algorithms are written in terms of to-be-specified-later.
◦In C++ class and function templates are particularly effective
mechanisms.
Object-Oriented Programming
◦decomposition of problem into a number of entities called objec
◦Emphasis is on data rather than procedure ??
◦Objects have attributes and can take actions
◦pass messages to objects, so that they take action
◦The same message works differently for various objects
◦A method can work appropriately with different types of data
◦Objects can inherit traits of previously created objects
◦Information hiding is more complete than in procedural program
◦New data and functions can be added easily whenever necessar
◦Follows bottom-up approach
Top Down approach
Identify the goal or problem:
The goal or problem needs to be clearly identified and
measurable.
Break it down into sub-goals:
The sub-goals/sub-problems are what the top-up approach i
all about.
Solve each sub-goal/sub-problem:
Using the same top-up approach, the sub-problems/sub-
goals/problems are broken down into smaller manageable
parts.
Repeat steps 2 and 3 until the overall goal/problems are
Bottom-Up Approach
Identify the components or tasks:
The components or tasks need to be clearly identified
and measurable.
Build the system or solution:
The system or solution gets its name from the fact that
it is built from the individual components/tasks.
Test:
The system/solution needs to be tested to meet the
requirements. This can be done by running a series of
tests on the system/solution.
Repeat steps 2 and 3:
This may involve several iterations of the bottom-up
Limitations of procedural programming
◦Difficult to relate with real world objects
◦Abstraction and modularization is difficult
◦Difficult to understand
◦Difficult to maintain
Need of object-oriented programming
◦Possible to map objects in the problem domain
◦Data Hiding : Security
◦ Inheritance : Eliminate redundancy , reusability
◦Its flexibility
◦ It makes the coding more organized
◦Simple maintenance, an advanced analysis of complicated
programs
Structured Vs OOP
Structured OOP
Focuses on
Process
Focuses on
Object
Follows Top
Down Approach
Follows Bottom
Up Approach
Fundamentals of object-oriented programming
◦ objects
◦ classes
◦ data members
◦ methods
◦ messages
◦ data encapsulation
◦ data abstraction and information hiding
◦ inheritance
◦ polymorphism
Object
◦Objects are basic run time entities.
◦ e.g. person, a place, a bank account, or any item that the
program has to handle.
◦Each object take up space in the memory to store data and
code.
◦OOP encapsulates data (attributes) and functions (behavior)
into packages called objects. Objects have the property of
information hiding.
◦Representation of object
◦Objects Interact with each other by sending messages to each
other.
Message Passing
• Class
◦A class is a blueprint or prototype that defines the data
members and the methods (functions) common to all objects
of a certain kind.
◦Objects (data and functions) are members of user-defined
types called classes.
◦A class definition is an extension of a C structure definition ,
made up of declarations of variables and of function
◦The variables are typically declared to be private or protected
and the functions are typically declared to be public.
◦structures members are public by default and class members
are private by default.
Example : Objects and Classes
Rima
R002
Rita
R003
Bina
R004
Rani
R001
class
object
class Student
char name
int rollNo
setName()
setRollNo()
calcMarks()
Program is composed of a collection of individual units
or objects, as opposed to a traditional view in which a
program is a list of instructions to the computer.
Data variable
Member
Function
Data variable
Member
Function
Data variable
Member
Function
Object A
Object B
Object C
• Data members
◦Attributes of object.
◦The variables are typically declared to be private or protected
• Methods or member functions or messages
◦Functions operate on class data.
◦ functions are typically declared to be public.
◦Defined outside or inside class.
◦Objects communicate with each other.
Encapsulation
◦The process of binding code and data together in the form of a capsule
◦Data is not accessible to the outside world, only those function which are
wrapped in the class can access it.
◦Since the classes use the concept of data abstraction, they are known as
Abstract Data Type(ADT).
◦EXAMPLE-tv
Data Abstraction or Data Hiding
◦The process of extracting the essential information and hiding the irrelevant
details
Inheritance
◦The feature by which one class acquires the properties and
functionalities of another class
◦Classes are extensible
◦You can create new classes that extend or are descendents of
existing classes
◦The descendent classes can inherit all the attributes of the
parent class
◦Hierarchical classification
◦Reusability
Inheritance
“Person” is a generalization of “Student”.
“Student” is a specialization of “Person”.
Person
Name
Gender
Age
Student
Reg. No.
Course
Marks
Teaching Staff
Qualification
Designation
Specialization

More Related Content

Similar to Introduction to Object oriented Programming basics (20)

Introduction to Object Oriented Programming.pptx
Introduction to Object Oriented Programming.pptxIntroduction to Object Oriented Programming.pptx
Introduction to Object Oriented Programming.pptx
ssuser8d54ed
 
Principles of OOPs.pptx
Principles of OOPs.pptxPrinciples of OOPs.pptx
Principles of OOPs.pptx
LakshyaChauhan21
 
Unit 1- Basic concept of object-oriented-programming.ppt
Unit 1- Basic concept of object-oriented-programming.pptUnit 1- Basic concept of object-oriented-programming.ppt
Unit 1- Basic concept of object-oriented-programming.ppt
hannahroseline2
 
C++ Programming with examples for B.Tech
C++ Programming with examples for B.TechC++ Programming with examples for B.Tech
C++ Programming with examples for B.Tech
ashutoshgupta1102
 
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPUUNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
ApurvaLaddha
 
1.1-Introduction to Object oriented.pptx
1.1-Introduction to Object oriented.pptx1.1-Introduction to Object oriented.pptx
1.1-Introduction to Object oriented.pptx
naushigrdcs
 
Object Oriented Programming intro Lecture 1.pptx
Object Oriented Programming intro Lecture 1.pptxObject Oriented Programming intro Lecture 1.pptx
Object Oriented Programming intro Lecture 1.pptx
ssuser8d54ed
 
Java chapter 3
Java   chapter 3Java   chapter 3
Java chapter 3
Mukesh Tekwani
 
PHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptxPHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptx
Atikur Rahman
 
Share Unit 1- Basic concept of object-oriented-programming.ppt
Share Unit 1- Basic concept of object-oriented-programming.pptShare Unit 1- Basic concept of object-oriented-programming.ppt
Share Unit 1- Basic concept of object-oriented-programming.ppt
hannahrroselin95
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
IndraKhatri
 
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.pptJava Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
akashsachu221
 
80410172053.pdf
80410172053.pdf80410172053.pdf
80410172053.pdf
WrushabhShirsat3
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)
MD Sulaiman
 
Basic concepts of oops
Basic concepts of oopsBasic concepts of oops
Basic concepts of oops
Chandrakiran Satdeve
 
1 unit (oops)
1 unit (oops)1 unit (oops)
1 unit (oops)
Jay Patel
 
Object Oriented Program Class 12 Computer Science
Object Oriented Program Class 12 Computer ScienceObject Oriented Program Class 12 Computer Science
Object Oriented Program Class 12 Computer Science
ShailendraPandey96
 
DSD Unit 1 Abstract Data Type data structures design notes.pptx
DSD Unit 1 Abstract Data Type data structures design notes.pptxDSD Unit 1 Abstract Data Type data structures design notes.pptx
DSD Unit 1 Abstract Data Type data structures design notes.pptx
yuvaraniit
 
Question bank unit i
Question bank unit iQuestion bank unit i
Question bank unit i
Rasi Manivannan
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
baabtra.com - No. 1 supplier of quality freshers
 
Introduction to Object Oriented Programming.pptx
Introduction to Object Oriented Programming.pptxIntroduction to Object Oriented Programming.pptx
Introduction to Object Oriented Programming.pptx
ssuser8d54ed
 
Unit 1- Basic concept of object-oriented-programming.ppt
Unit 1- Basic concept of object-oriented-programming.pptUnit 1- Basic concept of object-oriented-programming.ppt
Unit 1- Basic concept of object-oriented-programming.ppt
hannahroseline2
 
C++ Programming with examples for B.Tech
C++ Programming with examples for B.TechC++ Programming with examples for B.Tech
C++ Programming with examples for B.Tech
ashutoshgupta1102
 
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPUUNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
ApurvaLaddha
 
1.1-Introduction to Object oriented.pptx
1.1-Introduction to Object oriented.pptx1.1-Introduction to Object oriented.pptx
1.1-Introduction to Object oriented.pptx
naushigrdcs
 
Object Oriented Programming intro Lecture 1.pptx
Object Oriented Programming intro Lecture 1.pptxObject Oriented Programming intro Lecture 1.pptx
Object Oriented Programming intro Lecture 1.pptx
ssuser8d54ed
 
PHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptxPHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptx
Atikur Rahman
 
Share Unit 1- Basic concept of object-oriented-programming.ppt
Share Unit 1- Basic concept of object-oriented-programming.pptShare Unit 1- Basic concept of object-oriented-programming.ppt
Share Unit 1- Basic concept of object-oriented-programming.ppt
hannahrroselin95
 
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.pptJava Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
akashsachu221
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)
MD Sulaiman
 
1 unit (oops)
1 unit (oops)1 unit (oops)
1 unit (oops)
Jay Patel
 
Object Oriented Program Class 12 Computer Science
Object Oriented Program Class 12 Computer ScienceObject Oriented Program Class 12 Computer Science
Object Oriented Program Class 12 Computer Science
ShailendraPandey96
 
DSD Unit 1 Abstract Data Type data structures design notes.pptx
DSD Unit 1 Abstract Data Type data structures design notes.pptxDSD Unit 1 Abstract Data Type data structures design notes.pptx
DSD Unit 1 Abstract Data Type data structures design notes.pptx
yuvaraniit
 

More from SwatiAtulJoshi (6)

UNIVERSAL_HUMAN_VLAUES2_human aspirations1.pptx
UNIVERSAL_HUMAN_VLAUES2_human aspirations1.pptxUNIVERSAL_HUMAN_VLAUES2_human aspirations1.pptx
UNIVERSAL_HUMAN_VLAUES2_human aspirations1.pptx
SwatiAtulJoshi
 
universal_human Values _1_As suggested by AICTEaj.pptx
universal_human Values _1_As suggested by AICTEaj.pptxuniversal_human Values _1_As suggested by AICTEaj.pptx
universal_human Values _1_As suggested by AICTEaj.pptx
SwatiAtulJoshi
 
Kinematics for robotics inverse and forward
Kinematics for robotics inverse and forwardKinematics for robotics inverse and forward
Kinematics for robotics inverse and forward
SwatiAtulJoshi
 
Restoring and nonrestoring division.pptx
Restoring and nonrestoring division.pptxRestoring and nonrestoring division.pptx
Restoring and nonrestoring division.pptx
SwatiAtulJoshi
 
Logical Programming Paradigm for programming Languages.
Logical Programming Paradigm for programming Languages.Logical Programming Paradigm for programming Languages.
Logical Programming Paradigm for programming Languages.
SwatiAtulJoshi
 
How to do file-handling - in C language
How to do file-handling -  in C languageHow to do file-handling -  in C language
How to do file-handling - in C language
SwatiAtulJoshi
 
UNIVERSAL_HUMAN_VLAUES2_human aspirations1.pptx
UNIVERSAL_HUMAN_VLAUES2_human aspirations1.pptxUNIVERSAL_HUMAN_VLAUES2_human aspirations1.pptx
UNIVERSAL_HUMAN_VLAUES2_human aspirations1.pptx
SwatiAtulJoshi
 
universal_human Values _1_As suggested by AICTEaj.pptx
universal_human Values _1_As suggested by AICTEaj.pptxuniversal_human Values _1_As suggested by AICTEaj.pptx
universal_human Values _1_As suggested by AICTEaj.pptx
SwatiAtulJoshi
 
Kinematics for robotics inverse and forward
Kinematics for robotics inverse and forwardKinematics for robotics inverse and forward
Kinematics for robotics inverse and forward
SwatiAtulJoshi
 
Restoring and nonrestoring division.pptx
Restoring and nonrestoring division.pptxRestoring and nonrestoring division.pptx
Restoring and nonrestoring division.pptx
SwatiAtulJoshi
 
Logical Programming Paradigm for programming Languages.
Logical Programming Paradigm for programming Languages.Logical Programming Paradigm for programming Languages.
Logical Programming Paradigm for programming Languages.
SwatiAtulJoshi
 
How to do file-handling - in C language
How to do file-handling -  in C languageHow to do file-handling -  in C language
How to do file-handling - in C language
SwatiAtulJoshi
 
Ad

Recently uploaded (20)

Who will create the languages of the future?
Who will create the languages of the future?Who will create the languages of the future?
Who will create the languages of the future?
Jordi Cabot
 
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The SequelMarketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
BradBedford3
 
Software Testing & it’s types (DevOps)
Software  Testing & it’s  types (DevOps)Software  Testing & it’s  types (DevOps)
Software Testing & it’s types (DevOps)
S Pranav (Deepu)
 
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptxIMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
usmanch7829
 
Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4
Gaurav Sharma
 
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps CyclesFrom Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
Marjukka Niinioja
 
Essentials of Resource Planning in a Downturn
Essentials of Resource Planning in a DownturnEssentials of Resource Planning in a Downturn
Essentials of Resource Planning in a Downturn
OnePlan Solutions
 
Automating Map Production With FME and Python
Automating Map Production With FME and PythonAutomating Map Production With FME and Python
Automating Map Production With FME and Python
Safe Software
 
COBOL Programming with VSCode - IBM Certificate
COBOL Programming with VSCode - IBM CertificateCOBOL Programming with VSCode - IBM Certificate
COBOL Programming with VSCode - IBM Certificate
VICTOR MAESTRE RAMIREZ
 
FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025
Safe Software
 
Leveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer IntentsLeveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer Intents
Keheliya Gallaba
 
Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3
Gaurav Sharma
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free DownloadWondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
How the US Navy Approaches DevSecOps with Raise 2.0
How the US Navy Approaches DevSecOps with Raise 2.0How the US Navy Approaches DevSecOps with Raise 2.0
How the US Navy Approaches DevSecOps with Raise 2.0
Anchore
 
DevOps for AI: running LLMs in production with Kubernetes and KubeFlow
DevOps for AI: running LLMs in production with Kubernetes and KubeFlowDevOps for AI: running LLMs in production with Kubernetes and KubeFlow
DevOps for AI: running LLMs in production with Kubernetes and KubeFlow
Aarno Aukia
 
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Alluxio, Inc.
 
FME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable InsightsFME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable Insights
Safe Software
 
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdfThe Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
Varsha Nayak
 
wAIred_RabobankIgniteSession_12062025.pptx
wAIred_RabobankIgniteSession_12062025.pptxwAIred_RabobankIgniteSession_12062025.pptx
wAIred_RabobankIgniteSession_12062025.pptx
SimonedeGijt
 
Maximizing Business Value with AWS Consulting Services.pdf
Maximizing Business Value with AWS Consulting Services.pdfMaximizing Business Value with AWS Consulting Services.pdf
Maximizing Business Value with AWS Consulting Services.pdf
Elena Mia
 
Who will create the languages of the future?
Who will create the languages of the future?Who will create the languages of the future?
Who will create the languages of the future?
Jordi Cabot
 
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The SequelMarketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
BradBedford3
 
Software Testing & it’s types (DevOps)
Software  Testing & it’s  types (DevOps)Software  Testing & it’s  types (DevOps)
Software Testing & it’s types (DevOps)
S Pranav (Deepu)
 
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptxIMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
IMAGE CLASSIFICATION USING CONVOLUTIONAL NEURAL NETWORK.P.pptx
usmanch7829
 
Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4Software Engineering Process, Notation & Tools Introduction - Part 4
Software Engineering Process, Notation & Tools Introduction - Part 4
Gaurav Sharma
 
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps CyclesFrom Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
From Chaos to Clarity - Designing (AI-Ready) APIs with APIOps Cycles
Marjukka Niinioja
 
Essentials of Resource Planning in a Downturn
Essentials of Resource Planning in a DownturnEssentials of Resource Planning in a Downturn
Essentials of Resource Planning in a Downturn
OnePlan Solutions
 
Automating Map Production With FME and Python
Automating Map Production With FME and PythonAutomating Map Production With FME and Python
Automating Map Production With FME and Python
Safe Software
 
COBOL Programming with VSCode - IBM Certificate
COBOL Programming with VSCode - IBM CertificateCOBOL Programming with VSCode - IBM Certificate
COBOL Programming with VSCode - IBM Certificate
VICTOR MAESTRE RAMIREZ
 
FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025
Safe Software
 
Leveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer IntentsLeveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer Intents
Keheliya Gallaba
 
Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3Software Engineering Process, Notation & Tools Introduction - Part 3
Software Engineering Process, Notation & Tools Introduction - Part 3
Gaurav Sharma
 
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free DownloadWondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Wondershare PDFelement Pro 11.4.20.3548 Crack Free Download
Puppy jhon
 
How the US Navy Approaches DevSecOps with Raise 2.0
How the US Navy Approaches DevSecOps with Raise 2.0How the US Navy Approaches DevSecOps with Raise 2.0
How the US Navy Approaches DevSecOps with Raise 2.0
Anchore
 
DevOps for AI: running LLMs in production with Kubernetes and KubeFlow
DevOps for AI: running LLMs in production with Kubernetes and KubeFlowDevOps for AI: running LLMs in production with Kubernetes and KubeFlow
DevOps for AI: running LLMs in production with Kubernetes and KubeFlow
Aarno Aukia
 
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Alluxio, Inc.
 
FME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable InsightsFME for Climate Data: Turning Big Data into Actionable Insights
FME for Climate Data: Turning Big Data into Actionable Insights
Safe Software
 
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdfThe Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
The Future of Open Source Reporting Best Alternatives to Jaspersoft.pdf
Varsha Nayak
 
wAIred_RabobankIgniteSession_12062025.pptx
wAIred_RabobankIgniteSession_12062025.pptxwAIred_RabobankIgniteSession_12062025.pptx
wAIred_RabobankIgniteSession_12062025.pptx
SimonedeGijt
 
Maximizing Business Value with AWS Consulting Services.pdf
Maximizing Business Value with AWS Consulting Services.pdfMaximizing Business Value with AWS Consulting Services.pdf
Maximizing Business Value with AWS Consulting Services.pdf
Elena Mia
 
Ad

Introduction to Object oriented Programming basics

  • 1. UNIT II Object based Programming
  • 2. Procedural Programming ◦sequence of things ◦Emphasis is on doing things i.e. procedures. ◦share global data ◦top-down approach Modular Programming ◦Emphasizes separating the functionality ◦modules perform logically discrete functions. ◦no interaction between modules. ◦Each module works independently Generic Programming ◦Generic programming is about generalizing software components. ◦Algorithms are written in terms of to-be-specified-later. ◦In C++ class and function templates are particularly effective mechanisms.
  • 3. Object-Oriented Programming ◦decomposition of problem into a number of entities called objec ◦Emphasis is on data rather than procedure ?? ◦Objects have attributes and can take actions ◦pass messages to objects, so that they take action ◦The same message works differently for various objects ◦A method can work appropriately with different types of data ◦Objects can inherit traits of previously created objects ◦Information hiding is more complete than in procedural program ◦New data and functions can be added easily whenever necessar ◦Follows bottom-up approach
  • 4. Top Down approach Identify the goal or problem: The goal or problem needs to be clearly identified and measurable. Break it down into sub-goals: The sub-goals/sub-problems are what the top-up approach i all about. Solve each sub-goal/sub-problem: Using the same top-up approach, the sub-problems/sub- goals/problems are broken down into smaller manageable parts. Repeat steps 2 and 3 until the overall goal/problems are
  • 5. Bottom-Up Approach Identify the components or tasks: The components or tasks need to be clearly identified and measurable. Build the system or solution: The system or solution gets its name from the fact that it is built from the individual components/tasks. Test: The system/solution needs to be tested to meet the requirements. This can be done by running a series of tests on the system/solution. Repeat steps 2 and 3: This may involve several iterations of the bottom-up
  • 6. Limitations of procedural programming ◦Difficult to relate with real world objects ◦Abstraction and modularization is difficult ◦Difficult to understand ◦Difficult to maintain Need of object-oriented programming ◦Possible to map objects in the problem domain ◦Data Hiding : Security ◦ Inheritance : Eliminate redundancy , reusability ◦Its flexibility ◦ It makes the coding more organized ◦Simple maintenance, an advanced analysis of complicated programs
  • 7. Structured Vs OOP Structured OOP Focuses on Process Focuses on Object Follows Top Down Approach Follows Bottom Up Approach
  • 8. Fundamentals of object-oriented programming ◦ objects ◦ classes ◦ data members ◦ methods ◦ messages ◦ data encapsulation ◦ data abstraction and information hiding ◦ inheritance ◦ polymorphism
  • 9. Object ◦Objects are basic run time entities. ◦ e.g. person, a place, a bank account, or any item that the program has to handle. ◦Each object take up space in the memory to store data and code. ◦OOP encapsulates data (attributes) and functions (behavior) into packages called objects. Objects have the property of information hiding. ◦Representation of object
  • 10. ◦Objects Interact with each other by sending messages to each other.
  • 12. • Class ◦A class is a blueprint or prototype that defines the data members and the methods (functions) common to all objects of a certain kind. ◦Objects (data and functions) are members of user-defined types called classes. ◦A class definition is an extension of a C structure definition , made up of declarations of variables and of function ◦The variables are typically declared to be private or protected and the functions are typically declared to be public. ◦structures members are public by default and class members are private by default.
  • 13. Example : Objects and Classes Rima R002 Rita R003 Bina R004 Rani R001 class object class Student char name int rollNo setName() setRollNo() calcMarks()
  • 14. Program is composed of a collection of individual units or objects, as opposed to a traditional view in which a program is a list of instructions to the computer. Data variable Member Function Data variable Member Function Data variable Member Function Object A Object B Object C
  • 15. • Data members ◦Attributes of object. ◦The variables are typically declared to be private or protected • Methods or member functions or messages ◦Functions operate on class data. ◦ functions are typically declared to be public. ◦Defined outside or inside class. ◦Objects communicate with each other. Encapsulation ◦The process of binding code and data together in the form of a capsule ◦Data is not accessible to the outside world, only those function which are wrapped in the class can access it. ◦Since the classes use the concept of data abstraction, they are known as Abstract Data Type(ADT). ◦EXAMPLE-tv Data Abstraction or Data Hiding ◦The process of extracting the essential information and hiding the irrelevant details
  • 16. Inheritance ◦The feature by which one class acquires the properties and functionalities of another class ◦Classes are extensible ◦You can create new classes that extend or are descendents of existing classes ◦The descendent classes can inherit all the attributes of the parent class ◦Hierarchical classification ◦Reusability
  • 18. “Person” is a generalization of “Student”. “Student” is a specialization of “Person”. Person Name Gender Age Student Reg. No. Course Marks Teaching Staff Qualification Designation Specialization

Editor's Notes

  • #3: 2. The main aim of OOP is to bind together the data and the functions that operate on them so that no other part of the code can access this data except that function. Passing messages Message passing is similar to the idea of sending and receiving messages in real life. Suppose we are at a hotel and we want to order room service. For this, we write a message (place an order) to the room service department and put it in the internal messaging system of the hotel. Here message contains details about what we want and our room number. Similarly in OOP, one object can send a message to another object (room service department) with specific data (order details). Then other object performs the requested action based on the information provided in the message. Polymorphism is the core concept of the object-oriented programming language that allows programmers to build logical codes. In this concept of OOP, programmers can access objects of different types through the same interface where each type provides its own implementation of the interface
  • #4: In this approach, each function in a code is unique and works independently of other functions. The top-down approach is heavily used in the C programming language. Specification tends to change over time and in a top-down approach, all decisions made from the beginning of the project depend directly or indirectly on the high-level specification. In Dynamic Programming, the top-down approach is slow as compared to the bottom-up approach, as it involves recursion. There is a chance of stack overflow here. It takes more memory space as it involves recursion.
  • #6: POP has two major drawbacks, viz. (1) data move freely around the program and are therefore vulnerable to ranges caused by any function in the program, and (2) it does not model very well the real-world problems. GROUPINGOF SIMILAR OBJECTS int.o a class
  • #10: In OOPS, objects are self-sufficient units that possess their own data and behaviour. Suppose one object (Sender) wants to communicate with another object (Receiver) to access data or carry out an action by calling its methods. For this, Sender will send a message to Receiver and then Receiver will perform the desired action or returns the requested data.   Message passing provides an interface between objects and helps them to communicate in a loosely coupled way while keeping their inner complexities hidden.   In Java, we implement message passing using method calls. For example, when Object A invokes a public method of Object B, it is sending a message to Object B. Note that Object A can only invoke Object B's public methods, not its private methods.
  • #16: Inheritance is one of the key features of Object-oriented programming in C++. It allows us to create a new class (derived class) from an existing class (base class). The derived class inherits the features from the base class and can have additional features of its own.
  • #17: class Animal { // eat() function // sleep() function }; class Dog : public Animal { // bark() function };