Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "data abstraction" exactly mean?

What does data abstraction refer to? Please provide real life examples alongwith.

like image 668
Naruto Avatar asked Sep 03 '10 10:09

Naruto


People also ask

What do you mean by data abstraction?

Data abstraction is the reduction of a particular body of data to a simplified representation of the whole. Abstraction, in general, is the process of removing characteristics from something to reduce it to a set of essential elements.

What is data abstraction and example?

Data abstraction refers to providing only essential information about the data to the outside world, hiding the background details or implementation. Consider a real life example of a man driving a car.

What is the purpose of data abstraction?

Users can just view the data and interact with the database, storage and implementation details are hidden from them. The main purpose of data abstraction is to achieve data independence in order to save the time and cost required when the database is modified or altered.

What is data abstraction and explain its types?

Data Abstraction is a process of hiding unwanted or irrelevant details from the end user. It provides a different view and helps in achieving data independence which is used to enhance the security of data. The database systems consist of complicated data structures and relations.


2 Answers

Abstraction has two parts:

  • Hide details that don't matter from a certain point of view
  • Identify details that do matter from a certain point of view and consider items to be of the the same class if they possess those details.

For example, if I am designing a program to deal with inventory, I would like to be able to find out how many items of a certain type the system has in stock. From the perspective of the interface system, I don't care if I am getting this information from a database, a csv file, a remote repository via a SOAP interface or punch cards. I just care that I can can say widget.get_items_in_stock() and know that it will return an integer.

If I later decide that I want to record that number in some other way, the person designing the interface doesn't need to know, care or worry about it as long as widget still has the get_items_in_stock() method. Like wise, the interface doesn't need to care if I subclass the widget class and add a get_square_root_of_items_in_stock() method. I can pass an instance of the new class to it just as well.

So in this example, we've hidden the details of how the data is acquired and decided that anything with a get_items_in_stock() method is an instance of the same class (or a subclass thereof) for certain purposes.

like image 127
aaronasterling Avatar answered Sep 21 '22 04:09

aaronasterling


Data abstraction is any device that allows you to treat data as humans encounter it rather than as it is stored on machine.

At the lowest level, all primitive data types are abstractions -- as programmers, we don't usually have to deal with data at the bit level (which is how it is ultimately stored) but as integers, floating point numbers, characters, etc.

We then add layers onto that abstraction -- maybe two integers represents a Point, or we and enumerations to represent the months of the year, days of the week, etc.

With each abstraction layer, we move further from the machine and (hopefully) closer to human understanding of the data. This can extract a performance penalty -- it may not always be the case that points can be most efficiently represented by two integers. This is compensated for by the shorter development (and maintenance) time when abstractions are used.

like image 45
JohnMcG Avatar answered Sep 20 '22 04:09

JohnMcG