SlideShare a Scribd company logo
2
Most read
3
Most read
9
Most read
ABSTRACTION AND ENCAPSULATION
ABSTRACTION
- Ignoring those aspects of an object that are
not relevant to the current scope of the
problem.
- Reduces scope and helps managing
complexity.
ABSTRACTION
- Designing a website to sell new Cars.
Car
Description
Type
Price
…
ABSTRACTION
- Do I need to include Service History as a
field? No (Because it does not belong to new
car and is not relevant to current scope)
- Do I need to include Vehicle Registration
Number as a field? No (Because currently we
do not have and it’s not necessary currently.
You get the number after you buy the car.)
ABSTRACTION
EXCLUDE WHICH IS
NOT RELEVANT TO THE CURRENT SCOPE
ENCAPSULATION
- Provides interface to access the functionality of
the object & hides how it is implemented.
- Keep the attributes and behavior as one unit
– Helps to make it more independent.
ENCAPSULATION
- Example of Pressing ’A’ on Keyboard.
Keyboard
Press A --- 65
1000001
Laptop
ENCAPSULATION
- Keys are exposed as interface and as an end
user when I press ‘A’, it is printed on the screen.
I do not know how it is implemented.
- Implementation is hidden as to how it displays
that on screen.
- Hiding implementation has a benefit – you can
change the implementation later but you can still
have the same interface. Maintenance is easy.
ENCAPSULATION
- Other aspect of attributes and behavior as one
unit is it helps to make the object independent.
- As a programmer, you know when you press
A, 65 (ASCII) is sent as signal but for end user it
does not matter.
- 65 is hidden from end user and it is private to
Keyboard object, only inner methods have
access to it. This keeps them as one unit and
encapsulated.
CONCLUSION
- Abstraction comes before Encapsulation
- In Abstraction, we are trying to come up with
the scope of the problem.
- In Encapsulation, we are trying to come up
with the approach to solve and implement
problem in a better way.

More Related Content

PPTX
Abstract Data Types
PDF
Java threads
PPTX
Packages in java
PPTX
Abstract Class & Abstract Method in Core Java
PPTX
Methods in java
PPTX
Dynamic memory allocation
PPT
Operator Overloading
PPTX
Interface in java
Abstract Data Types
Java threads
Packages in java
Abstract Class & Abstract Method in Core Java
Methods in java
Dynamic memory allocation
Operator Overloading
Interface in java

What's hot (20)

PPT
Function overloading(c++)
PDF
Operator overloading C++
PPTX
Applets in java
PPTX
Pointers in c++
PPTX
Control flow statements in java
PDF
Applications of stack
PPTX
Polymorphism presentation in java
PPTX
Friend function
PPT
Deadlock in operating systems
PPTX
Operator Overloading & Function Overloading
PPT
PPTX
Graph traversals in Data Structures
PPTX
Stack using Linked List
PDF
Constructors and Destructors
PPT
Method overriding
DOCX
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
PPTX
Java if else condition - powerpoint persentation
PPTX
Data structures and algorithms
PDF
sparse matrix in data structure
PPT
Object Oriented Programming with Java
Function overloading(c++)
Operator overloading C++
Applets in java
Pointers in c++
Control flow statements in java
Applications of stack
Polymorphism presentation in java
Friend function
Deadlock in operating systems
Operator Overloading & Function Overloading
Graph traversals in Data Structures
Stack using Linked List
Constructors and Destructors
Method overriding
The Relational Data Model and Relational Database Constraints Ch5 (Navathe 4t...
Java if else condition - powerpoint persentation
Data structures and algorithms
sparse matrix in data structure
Object Oriented Programming with Java
Ad

Viewers also liked (20)

PPTX
Array y Objects C#
PPT
c# training | c# training videos | c# object oriented programming | c# course
PPTX
PDF
Var vs iEnumerable
PPTX
Object Oriented Programming with C#
PPTX
DATATYPE IN C# CSHARP.net
PPT
Generics collections
PPTX
Objects and Types C#
PPTX
Classes and Objects In C# With Example
PPTX
Modern pptx
PPTX
Collections in-csharp
PPTX
C# in depth
PPTX
Learn Concept of Class and Object in C# Part 3
PPTX
PPTX
C# Generics
PPT
7.data types in c#
PPTX
introduction to c #
PPTX
.NET Platform. C# Basics
PPTX
Unit Testing, TDD and ATDD
PPTX
Advanced C#. Part 1
Array y Objects C#
c# training | c# training videos | c# object oriented programming | c# course
Var vs iEnumerable
Object Oriented Programming with C#
DATATYPE IN C# CSHARP.net
Generics collections
Objects and Types C#
Classes and Objects In C# With Example
Modern pptx
Collections in-csharp
C# in depth
Learn Concept of Class and Object in C# Part 3
C# Generics
7.data types in c#
introduction to c #
.NET Platform. C# Basics
Unit Testing, TDD and ATDD
Advanced C#. Part 1
Ad

Similar to Abstraction and Encapsulation (8)

DOC
SAP FI Configuration guide and enduser manual
DOC
SAP FI Configuration guide and enduser manual
PDF
The logic behind choosing logic controllers
PDF
Enterprise UX 2015 Recap
PPTX
Unified Modeling Language -UML_COM213 SLIDES.pptx
PPTX
Unified Modeling Language -UML_COM213 SLIDES.pptx
PPTX
Computational Thinking for Advanced level Computer science 0796.pptx
PPT
Aloma_081031
SAP FI Configuration guide and enduser manual
SAP FI Configuration guide and enduser manual
The logic behind choosing logic controllers
Enterprise UX 2015 Recap
Unified Modeling Language -UML_COM213 SLIDES.pptx
Unified Modeling Language -UML_COM213 SLIDES.pptx
Computational Thinking for Advanced level Computer science 0796.pptx
Aloma_081031

Recently uploaded (20)

PDF
Empowerment Technology for Senior High School Guide
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
Classroom Observation Tools for Teachers
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PDF
Hazard Identification & Risk Assessment .pdf
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
advance database management system book.pdf
PDF
Indian roads congress 037 - 2012 Flexible pavement
PDF
IGGE1 Understanding the Self1234567891011
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Weekly quiz Compilation Jan -July 25.pdf
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
Empowerment Technology for Senior High School Guide
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Classroom Observation Tools for Teachers
Paper A Mock Exam 9_ Attempt review.pdf.
Hazard Identification & Risk Assessment .pdf
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
Chinmaya Tiranga quiz Grand Finale.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
UNIT III MENTAL HEALTH NURSING ASSESSMENT
LDMMIA Reiki Yoga Finals Review Spring Summer
advance database management system book.pdf
Indian roads congress 037 - 2012 Flexible pavement
IGGE1 Understanding the Self1234567891011
A systematic review of self-coping strategies used by university students to ...
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Weekly quiz Compilation Jan -July 25.pdf
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
History, Philosophy and sociology of education (1).pptx
Supply Chain Operations Speaking Notes -ICLT Program

Abstraction and Encapsulation

  • 2. ABSTRACTION - Ignoring those aspects of an object that are not relevant to the current scope of the problem. - Reduces scope and helps managing complexity.
  • 3. ABSTRACTION - Designing a website to sell new Cars. Car Description Type Price …
  • 4. ABSTRACTION - Do I need to include Service History as a field? No (Because it does not belong to new car and is not relevant to current scope) - Do I need to include Vehicle Registration Number as a field? No (Because currently we do not have and it’s not necessary currently. You get the number after you buy the car.)
  • 5. ABSTRACTION EXCLUDE WHICH IS NOT RELEVANT TO THE CURRENT SCOPE
  • 6. ENCAPSULATION - Provides interface to access the functionality of the object & hides how it is implemented. - Keep the attributes and behavior as one unit – Helps to make it more independent.
  • 7. ENCAPSULATION - Example of Pressing ’A’ on Keyboard. Keyboard Press A --- 65 1000001 Laptop
  • 8. ENCAPSULATION - Keys are exposed as interface and as an end user when I press ‘A’, it is printed on the screen. I do not know how it is implemented. - Implementation is hidden as to how it displays that on screen. - Hiding implementation has a benefit – you can change the implementation later but you can still have the same interface. Maintenance is easy.
  • 9. ENCAPSULATION - Other aspect of attributes and behavior as one unit is it helps to make the object independent. - As a programmer, you know when you press A, 65 (ASCII) is sent as signal but for end user it does not matter. - 65 is hidden from end user and it is private to Keyboard object, only inner methods have access to it. This keeps them as one unit and encapsulated.
  • 10. CONCLUSION - Abstraction comes before Encapsulation - In Abstraction, we are trying to come up with the scope of the problem. - In Encapsulation, we are trying to come up with the approach to solve and implement problem in a better way.