- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference Between Abstraction and Data Hiding
In object oriented programming (OOP), abstraction and data hiding are two important concepts. Abstraction is a process of extracting important information without involving the complete detail of the system. On the other hand, data hiding is a process of wrapping the data in a single unit, i.e., to achieve data encapsulation.
Read this article to learn more about abstraction and data hiding and how these two concepts are different from each other.
What is Abstraction?
Abstraction, or data abstraction, is one of the object-oriented methodologies. Abstraction is defined as the process of hiding the internal implementation and keeping the complicated procedures hidden from the user. Thus, abstraction only displays the required services or parts of the system. This is usually achieved using the 'abstract' class concept, and by implementing interfaces.
In abstraction, only the important details of the system are highlighted and the rest of the intricate details are not shown to the user.
Types of Abstraction
There are three types of abstraction, namely,
Procedural abstraction − Procedures are written as methods/functions one followed by the other. It is done in sequence in order to obtain abstraction.
Data Abstraction − Abstraction is achieved using data set that is used to describe the object of the class.
Control Abstraction − Here, it is achieved by using objects by ensuring that the details of the object are hidden from user.
Abstraction helps in securing the software. It does not affect endusers, since the developers can perform changes internally. Abstraction ensures that the application is flexible and user-friendly.
What is Data Hiding?
In OOP, data hiding refers to the task of hiding the internal data from outsiders. With the help of data hiding, the internal data would not be accessible by irrelevant people. Data hiding can be achieved using access specifiers, such as 'private', and 'protected'. It acts like a security layer as it ensures that users cannot access internal data without authentication.
In data hiding, getters and setters can be used to access the data or to modify it. "getters" help in accessing the private data, while "setters" help in changing the settings of data, i.e., modifying the private data.
Difference between Abstraction and Data Hiding
The following table highlights all the important differences between abstraction and data hiding −
S.No. |
Abstraction |
Data Hiding |
---|---|---|
1. |
The process of hiding the implantation details and showing only the functionality of program is referred to as abstraction. |
The process of hiding important and sensitive data from any unintended access is known as data hiding. |
2. |
Abstraction helps in extracting relevant information from a larger set of information. |
Data hiding helps to increase safety by preventing outside attacks. |
3. |
Abstraction focuses on reducing the complexity of code. |
The purpose of data hiding is to achieve data encapsulation. |
4. |
Abstraction solves the design level problems. |
Data hiding solves the implementation level problems. |
5. |
There are three types of data abstractions namely, procedural abstraction, data abstraction, and control abstraction. |
Data hiding is not divided into subtypes. |
Conclusion
The most significant difference between the two is that data abstraction is used to hide the complexity of the system, while data hiding is used to achieve encapsulation of data.
- Related Articles
- Difference Between Data Hiding and Encapsulation
- Difference between Abstraction and Virtualization
- Difference Between Abstraction and Encapsulation
- Explain difference between Abstraction and Encapsulation in PHP.
- Difference between Method Overriding and Method Hiding in C#
- What is the difference between abstraction and encapsulation in Java?
- What is the difference between overriding and hiding in C#?
- Data Hiding in Python
- What is the difference between method hiding and method overriding in Java?
- What is the difference between method overloading and method hiding in Java?
- What is the difference between function overriding and method hiding in C#?
- What is data Abstraction in DBMS?
- Difference between data type and data structure
- Difference Between Data Warehouse and Data Mart
- Difference between Data Mining and Big Data
