Difference Between Abstraction and Data Hiding (With Table)

Object-Oriented Programming(OOP) is a popular concept. It is used in various programming languages like Python, Java, etc. It is used to simplify the long codes and execute the function easily. OOPs became a basic knowledge in every programming language. Python is one best example that work using OOPS concepts.

Abstraction vs Data Hiding

The main difference between abstraction and data hiding is their function. Abstraction is nothing but extracts only relevant information from vast data, whereas data hiding is a process where the data are get hiding. The purpose of abstraction is to reduce or decrease the complexity of the program, whereas the purpose of data hiding is to achieve the encapsulation property.

Abstraction is a process in which the relevant or needed information is extracted or displayed from a vast amount of data and displayed to the user. The unwanted or unimportant information is hidden from the user’s display. For example, consider a car in a car showroom. The serviceman shows the entire car without its individual components. Abstraction is used in many programming languages. It is an essential method and one of the concepts in Object-Oriented Programming(OOP)

Data hiding is look similar to abstraction but it is not. Data hiding is a process of hiding information and details. Like abstraction, data hiding is also an object-oriented programming method or technique. Data hiding is an essential or important process to secure your precious information from attackers. The data hiding process maintains data integrity. It helps to maintain and secure valuable information. Data hiding need longer codes which is a disadvantage for this process.

Comparison Table Between Abstraction and Data Hiding

Parameters of coparison

Abstraction

Data Hiding

Types

Abstraction has three types

Data hiding has no types

Meaning

Abstraction is a process that extracts relevant information

Data hiding is a process that hides the data

Purpose

The purpose of abstraction is to lessen the complexity

The purpose of data hiding is to achieve encapsulation

Used

Abstraction is used to implement the details.

Data hiding is used to secure data.

Other names

Data Abstraction

Information hiding

What is Abstraction?

Abstraction is also called data abstraction. In simple, it is a process of extracting data. You can also say that identifying the required elements is called abstraction. The properties of an object are not similar for every object. Identifying the characteristics and properties of an object will help to extract the correct and right amount of data easily and quickly. By identifying the characteristics you can easily group the objects. You can connect the abstraction to your real-life stories.

Consider the example of the man driving a car. The man who drives the cr knows only about the basic details of driving are the needed requirements of driving. He knows increasing speed, braking, decreasing speed, basic repairs. But he doesn’t know the inner functions of the entire car. Only the manufacturer knows the entire working system of the car. This is called abstraction or data abstraction. You can use abstraction in JAVA by interfaces and abstract classes.

Before using the abstraction in a programming language, you need to know about the abstract classes and abstract methods. You can declare the abstract method without implementation in a programming language. The method defined the abstract need to be refined in the sub-class to avoid a clash with other methods. The primary advantage of abstraction is reducing the complexity of viewing a particular thing from vast data.

What is Data Hiding?

Data hiding is a process. In Simple, data hiding will hide your internal important information from exposure to attackers. It prevents accessing the data outside the class. The data hiding will hide only data components, whereas data encapsulation will hide private methods and classes. Data hiding is similar to data encapsulation. The data hiding just limits your data from the display and assure the security of the data. You can also reduce the complexity of the system by data hiding.

In a programming language, the data hiding is achieved by private access specifier. Consider an example of an account with a balance. Here the balance of an account is sensitive information. So we can allow the user to check the balance without altering the attitude of the balance. It is how data hiding works in real-life examples. Data hiding is also known as information hiding. Data Encapsulation is a sub-process in data hiding. Data hiding will protect your data from unauthorized access.

The three different classes namely private class, public class, and protected class have different syntax for the data hiding. The private class is only accessed by methods. The public class can be accessed anywhere and the protected class accessed within the private class. They are called access specifiers. Data concealing is an important process done in data hiding. The concealment of the data will provide security to your data. The data complexity and unpredictability can be reduced by data hiding

Main Differences between Abstraction and Data Hiding

  1. Abstraction has three types, whereas data hiding has no types.
  2. The purpose of abstraction is to lessen the complexity, whereas the purpose of data hiding is to achieve encapsulation.
  3. Abstraction is used to implement the details, and data hiding is used to secure data.
  4. Abstraction is a process that extracts relevant information, whereas data hiding is a process that hides the data.
  5. Abstraction is also called data abstraction, whereas data hiding is also called information hiding.

Conclusion

Abstraction and data hiding are two different concepts of object-oriented programming. Both are used in many programming languages. Abstraction is used to implement the data or to extract the relevant data from vast data. Data hiding is the contrary process to abstraction. In data hiding, the information is hidden to secure the data. The main purpose of data hiding is to protect the data from exposure. Both the process have their advantages and disadvantages. It is vital to know the syntax to use in programming. Both the concepts will improve the level of your program and reduce memory.

References

  1. https://dl.acm.org/doi/abs/10.1145/3313950.3313952?casa_token=6fu7UEFh8rsAAAAA:yrV-q-hjBohiZ9AlCpDoNDzC7zHGCXWo_BxzlHffw6fqGUcPhcPqrGxWacitLfcI5CljbvGw2gZl9xg
  2. https://ieeexplore.ieee.org/abstract/document/6215044/