What does "data abstraction" exactly mean?
Asked Answered
H

16

15

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

Hardware answered 3/9, 2010 at 10:36 Comment(2)
en.wikipedia.org/wiki/Abstraction_%28computer_science%29Violent
to tie into the answer below, if you have an inventory of tools, hammers,screwdrivers,saws etc. getting the number of tools is an abstraction since you don't care what kind of tools it isSuburb
I
20

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.

Inflatable answered 3/9, 2010 at 10:53 Comment(0)
K
12

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.

Ketty answered 3/9, 2010 at 16:13 Comment(0)
E
6

The technique of creating new data type that is well suited to an application to be programmed is known as data abstraction.

Empson answered 11/12, 2012 at 6:44 Comment(1)
Thanks for your answer. In the future, please do not post in all bold; that defeats the purpose of emphasis in the first place.Photoreconnaissance
K
1

Abstraction means providing only essential information to the outside world and hiding their background details..examp. In ur Computer u can see only monitor, keyboard nd mouse..u don't know anything about internal wiring this is abstraction.

Koosis answered 12/7, 2014 at 11:53 Comment(0)
P
1

Data abstraction seems to be explained as breaking data down as far as you can get it. food would be the abstraction of apple, orange, pizza. animal would be the abstraction of cat, cow, pig. A food object would be something like this pseudo code:

class food{

 name;
 calories;
 weight;

 public eat(name);

 }

all foods have a name, calorie amount, and a weight. That's pretty abstract.

You could then make objects that inherit, which would be a bit less abstract.

class pizza inherits food{

  toppings;

  say_toppings();

}

pizza now has toppings, but it inherits name, calories, and weight from food.

basically abstraction has been explained as getting to the lowest level of each item and making classes that extend from them. It makes your code more reusable too... If you've bade your base class of food well enough, and included everything abstract about it anyone working in the food industry could use your class.

Pearly answered 26/9, 2014 at 23:35 Comment(0)
P
1

Abstraction is hiding the skeleton from the human body. The skin does a great way of containing it. (See how abstract I'm being there? Pun intended. I digress...)

If I have a water bottle, then I'm able to drink from it by opening the lid, twisting it until it pops off.

bool lid_open = false;
void open_water_bottle_by_twisting() { lid_open = true; }

But water bottles are containers. Containers hold liquids until they become open and they are able to be drunk from (assuming the liquid is drinkable).

class Container 
{ 
    bool lid_open = false;

protected: 
    Container() {}
    void open_by_twisting()
    {
        lid_open = true;
    }
public:
    virtual ~Container();
};

class WaterBottle : public Container
{
    WaterBottle() : Container() {}
public:
    ~WaterBottle();
};

However, not all containers are opened the same way. Some containers, such as the water bottle, have lids that can be twisted off. Others don't have lids, such as exercise bottles - those contain bendy straws that can be bent down for storage or up for drinking.

class Container 
{ 
    bool lid_open;
    bool straw_open;

protected:
    void TurnLid() { lid_open = true; }
    void BendStraw() { straw_open = true; }
    Container() : lid_open(false), straw_open(false){}

public:
    virtual void open() = 0;
    virtual ~Container();
};

class WaterBottle : public Container
{

public: 
    WaterBottle() : Container() {}
    void open()
    {
        TurnLid();
    }
    ~WaterBottle();
};

class ExerciseBottle : public Container
{
public:
    ExerciseBottle() : Container() {}
    void open()
    {
        BendStraw();
    }
    ~ExerciseBottle();
};

But the client doesn't know what ExerciseBottle's implementation of ExerciseBottle's open() is. It calls BendStraw(), which then sets straw_open to true. But ExerciseBottle simply calls one function to do all of this work. The client doesn't have to perform several actions that are used in the implementation of open(). The case goes similarly for WaterBottle. And that's what abstraction is: letting the client know that the back-end will do all of the work for it. When the term "separating implementation from interface" is used, this is what is meant.

Paronomasia answered 23/6, 2016 at 2:59 Comment(0)
P
0

Is the complex system that uses data details which are easy to interact or encounter with humans, which differ from the way computer system stores such as in binary number system. Answered by Neema, Rohan and Upendo (The programmers)

Pout answered 14/4, 2013 at 12:8 Comment(0)
S
0

The technique of limiting the data attributes according to given scenario for development of software and removing all irrelevant attributes.This makes software development simpler.

Siloam answered 15/4, 2013 at 11:40 Comment(1)
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post.Harlie
A
0

Let's take one real life example of a TV which you can turn on and off, change the channel, adjust the volume, and add external components such as speakers, VCRs, and DVD players BUT you do not know it's internal detail that is, you do not know how it receives signals over the air or through a cable, how it translates them, and finally displays them on the screen.

Accentuate answered 17/5, 2013 at 18:5 Comment(0)
S
0

It refers to the act of representing essential feature without including the background detail or the explanation

Saturniid answered 14/9, 2013 at 9:21 Comment(0)
S
0

It is difficult to find day to day life example of DATA abstraction. However, any data types in programming language, tables and view in DBMS, data structures like LinkedList, List, Queue, Stack are data abstractions. These abstractions provide you the way to access the data in particular manner.

This article may help you understand data abstraction and control abstraction in depth. It also has some of the real life examples of control and data abstractions.

Salaried answered 19/9, 2013 at 17:17 Comment(0)
D
0

Abstraction rrefers to the act of representing essential features without including the background detail or explanation.

Debra answered 30/4, 2014 at 1:19 Comment(0)
K
0

Simply Data Abstraction is nothing but the hiding unnecessary datails from user. Example:Person simply just wants to make a call, he just select or dial no. and click on call button this info. is enough for him.He dont want to know about how connection is made and whatever process behind making call or how voice is transferred.

Kinny answered 14/9, 2014 at 7:42 Comment(0)
Z
0

I know this question was asked long time ago. But still like to share one real life example which might help others to understand concept of abstraction very easily.

A real-world analogy of abstraction might work like this: You (the object) are arranging to meet a blind date and are deciding what to tell them so that they can recognize you in the restaurant. You decide to include the information about where you will be located, your height, hair color, and the color of your jacket. This is all data that will help the procedure (your date finding you) work smoothly. You should include all that information. On the other hand, there are a lot of bits of information about you that aren't relevant to this situation: your social security number, your favorite football players all are irrelevant to this particular situation because they won't help your date to find you.

Zealot answered 27/12, 2015 at 17:37 Comment(0)
D
0

Data Abstraction: It is used to provide the necessary information to the user and hide the unnecessary information from the user. It is called data abstraction. It will hide your business logic from outside the world.

Technical Example: Console.WriteLine();

Non Technical Example: TV remote, Car Remote.

More Detail: Data Abstraction with real-time example

Dugan answered 22/6, 2018 at 11:24 Comment(0)
F
-2

data hiding deals the security features of oops. according to this property private data member of a class is accessible or visual only inside the class not outside the class.

Fivestar answered 18/7, 2015 at 18:48 Comment(1)
Incomplete. By this reasoning, you can have function foo that uses a public function bar. The public function bar would be used in the internal implementation of foo, but bar can be called by the client. Incomplete.Paronomasia

© 2022 - 2024 — McMap. All rights reserved.