Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what are the advantage of abstraction in OOP?

 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the advantage of abstraction in OOP?
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found one.
It is reusability.
is there any other things?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Readability too. If things are properly abstracted, the reader doesn't need to retain everything in his/her head at once.
 
Anwar Hussain
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi aruna , Abstraction is mainly meant for removing the code duplication and also for supporting polymophism and also code reusability.
 
Muhammad Khojaye
Ranch Hand
Posts: 449
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
aruna sameera wrote:what is the advantage of abstraction in OOP?


Abstraction lets you focus on what the object does instead of how it does it.
see also Abstraction
 
Anwar Hussain
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Muhammad Ali Khojaye wrote:
aruna sameera wrote:what is the advantage of abstraction in OOP?


Abstraction lets you focus on what the object does instead of how it does it.
see also Abstraction


hey , link you sent was pointing towards my point i.e abstraction eliminates duplication of code. Have you read the link topic before sending it???
 
Muhammad Khojaye
Ranch Hand
Posts: 449
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i know
and i am more focus on "Abstraction in object oriented programming".
 
Anwar Hussain
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please give me one example where in abstraction is to hide the implementation details from user as you said.
 
Antany Vasanth
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Anwar,

Hiding implementation details means not from user. It hides implementation logic from another class.

The other class doesn't need to know about the logic. It simply uses the class without knowing about implementation. Even any update to the logic doesn't require modification of another class. Its called as hiding implementation details.

Regards,
Ant
 
Tekchand Prasad
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abstraction provides necessary properties and operation of an Entity
 
Anwar Hussain
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ant,

Then every programming language in existance supports abstraction. Is't it??? Abstarction is a feature of OO language.But every language is not OO. Getting my point.

 
Muhammad Khojaye
Ranch Hand
Posts: 449
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider the collection framework that defines the abstraction called java.util.map. It defines an abstract view of an object that maps from one set of objects in to another. Different classes like java.util.HashMap or java.util.TreeMap implements the Map abstraction.
we generally implement abstraction using interfaces or abstract classes, and then provide implementation elsewhere to hide the details.
 
Anwar Hussain
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May i know why the implementation details should be hidden. And also whom form you are hiding the implementation details.
The developer who implements the abstraction knows abt the implementation details. Iam confused about this hiding in java.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic