• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Data abstraction vs Data Encapsulation

 
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Can some on please define the terms clearly and provide the differences.

I am so very confused with these terms.

Cheers
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Abstraction is about leaving out details that don't matter in the current conversation so you can focus on other details that do matter. For example a method that takes a List parameter cares about the behavior that is promised by the List interface, but doesn't care whether it's an ArrayList or LinkedList or some other implementation. So we call List an abstraction and ArrayList a concrete example. Or I might say I have a program that is a socket server without going into all the details of ports, socket objects, IO exceptions, message payloads and so on.

What matters and what you can leave out depends on the conversation and the audience. If I explain my program to somebody who must write their first socket program as a client to my server, I might give them many more details.

Encapsulation has about as many definitions as there are OO programmers. I'd say it's some mix of bringing together related code and data and hiding information about the details. Some of the big names in the business have said that encapsulation == information hiding, while others point out that not all information hiding leads to good encapsulation and not all encapsulation leads to good information hiding.

Any of that help? Raise new questions?
 
Stan James
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Forgot to say 1) Welcome to the ranch! 2) The sheriffs will come around and remind you that your name should be a credible first and last name. 3) The OO, UML, etc. forum down the page talks about this kind of stuff all the time.

Enjoy your time here!
 
Heroic work plunger man. Please allow me to introduce you to this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic