What Is Data Abstraction?
Data abstraction is the programming process of creating a data type, usually a class, that hides the details of the data representation in order to make the data type easier to work with. Data abstraction involves creating a representation for data that separates the interface from the implementation so a programmer or user only has to understand the interface, the commands to use, and not how the internal structure of the data is represented and/or implemented.
Smartphone Example
An example in the real-world is a mobile or smartphone. The typical smartphone user does not know how calls are made, or how the phone accesses the Internet, or even how data is stored in the phone. Instead, the mobile or smartphone user is provided with an interface that hides these details from them. Making a call simply involves selecting a contact's phone number. Accessing the Internet involves selecting an icon on the screen.
The user does not need to understand the details of how a phone call is placed or how the Internet works. These details are abstracted away from the phone's interface in order to make the phone easier and more effective to use. The design of the mobile or smartphone clearly separates the interface from the implementation. The user can learn the functions of the phone without ever having to know anything about how the phone works internally.
Automobile Example
Another real-life example is an automobile. Most people today know how to operate an automobile without knowing anything about how the internal combustion engine works or how the transmission works. There was a time when most automobile users did have to know something about these details, but as automobile technology improved, the details of the engine and other working parts were abstracted away so that the driver primarily only has to know how to start a car, how to make the car go and stop, how to steer the car, and how to add gasoline when the gas tank is empty.
The automatic transmission is another example of abstraction. When cars were first produced, they only had manual transmissions, and all car drivers had to learn how to shift the gears of the transmission in order for the car to move forward or backward. Over time, the introduction of the automatic transmission abstracted away this layer of knowledge about the implementation of the automobile, making car driving easier for the user.