This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About Abstraction in OOP Concept

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi
The defination for Abstraction is

Abstratction means hiding the internal details of the Object .

For the above can i take this as an example ??

Assume we are having a method called as Insert in the Data Access Layer .

The user simply calls insert .

Thank you .
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for clarifying .
 
Hiram Nascimento
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In fact abstraction means more the than just hiding implementation (it's more to do with Encapsuling).

Abstraction, in OOP concept, means choosing only aspects and behaviors that matters for your problem domain and, so, through the abstraction, you will be able to offer a simple interface (not necessarily a Java Interface) for the user to access/manipulate the class'es instances. Having a simple interface has much to do with encapsuling.

Imagine a cell phone:
You have the numeric keyboard, which is a simple interface for the internal eletronic circuits (that means an abstract way to send eletronic pulses to the CPU). Through the Abstraction you could encapsulate/hide the complicated implementation of how the keyboard generates the pulses. The cell phone user doesn't care how the Keyboard generates the pulses to send to the CPU (unless you are an electrical engineer ).

Now try to imagine a Television and answer: How would you model a TV on OOP? (This is part of the abstraction process)

It will depend on what's your problem domain: Will you use a TV object on a Shopping Cart or on a Electronics Factory?

http://en.wikipedia.org/wiki/Abstraction_%28computer_science%29

Does it make sense?

Indeed it's not the easier concept to understand.

Thanks,
Hiram
 
sindhu somisetty
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanku Hiram for tat info ,

Abstarction is nothing but showing outside view of object rather than its implementation.

The best example is ,

Consider a Display class for an application(say) which displays output .
Here 3 cases arises for display ,the display of application may be GUI or on command line text display or may the data that is retrived from database.

There are 3 different types of display cases for the same problem.
Therefore in order to handle this ,we can create one abstract class as Display and extend this abstract class functionality to 3 diff cases say TextDisplay class ,Gui class,DataStorage class .What so ever case we want we can call that type of class method(overriden) at runtime without affecting to other part of code .

This is main significance of abstraction.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic