Results 1 to 5 of 5
Thread: Abstraction
- 07-04-2010, 08:47 AM #1
Member
- Join Date
- Jun 2010
- Posts
- 45
- Rep Power
- 0
- 07-04-2010, 09:28 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,380
- Blog Entries
- 7
- Rep Power
- 17
Abstraction is more than hiding of data; it can also hide behaviour. Think of Lists; they are Iterable. All you know of an Iterable (an interface) is that it can give you an Iterator (also an interface). Hopping from one element to the next in an array (ArrayList) is quite different than hopping from one element to the next over a linked list (LinkedList). The behaviour is hidden from you by the iterator which was created by the Iterable. The actual behaviour is abstracted away from you.
kind regards,
Jos
- 07-04-2010, 09:35 AM #3
Member
- Join Date
- Jun 2010
- Posts
- 45
- Rep Power
- 0
okay you mean to say that by abstraction we dont care about the behavior, we just use the functionality.
- 07-04-2010, 09:59 AM #4
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,380
- Blog Entries
- 7
- Rep Power
- 17
Yes, abstraction is more about common functionality (Iterables and Iterators) while data hiding is more about data security and putting the responsibility for that data where it belongs. Together the two define encapsulation, not only for data but also for behaviour.
Inheritance can also be used for abstraction: a superclass defines the common behaviour and the subclasses (can) inherit the behaviour. The same goes with the data. Inheritance does create a tight coupling between the classes while interface implementation (Iterables and Iterators again) does not.
kind regards,
Jos
- 07-04-2010, 06:26 PM #5
Member
- Join Date
- Jun 2010
- Posts
- 45
- Rep Power
- 0
Similar Threads
-
diff between abstraction and inheritance
By sandeepsai17 in forum New To JavaReplies: 4Last Post: 05-24-2010, 06:04 AM -
Abstraction
By anurag in forum New To JavaReplies: 6Last Post: 05-15-2010, 06:15 PM -
[SOLVED] Abstraction: Pillar of OOP?
By leiferouis in forum New To JavaReplies: 7Last Post: 01-31-2009, 08:31 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks