Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have been studying the concepts of Object oriented programming. Still I am not able to distinguish between the following concepts of object oriented programming.

a) Data Binding

b) Data Hiding

c) Data Wrapping

d) Encapsulation

e) Data Abstraction

I have gone through a lot of books, and I also search the difference in google. But still I am not able to make the difference between these?

Could anyone please help me?

share|improve this question

closed as not a real question by gnat, Yusubov, Walter, Matthieu, World Engineer Sep 8 '12 at 9:53

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Duplicate of : stackoverflow.com/questions/24626/… –  abhiii5459 Sep 7 '12 at 6:38
add comment

2 Answers 2

Let us say you need to track the academic records of 'N' number of students in a class. The program should print out the name of student, roll no and GPA for the student.

So we create a bean class Student. Now to test the above wrong we write following code in main class

Now in terms of the above program, the concepts can be explained in this way.

class TestStudent
    public static void main(String[] args)
      Student s1=new Student();
      Student s2=new Student();



      System.out.println("Student Name :  Roll No : GPA");


Data Binding

Two objects of class Student, S1, S2 are accessing the variables rollNo,Name,GPA through a method. Here you are binding the data(variables) with a method. Or in some cases you could also bind one variable with another. In more complex applications, data binding is where you get two disparate data sources talking to each other, for eg XML to Database.

Data Hiding

Here you have two different objects S1,S2 accessing the data. Now S1 is not aware of the value of data being accessed by S2 and vice versa. The actual data is visible only to the variables or methods that are accessing it, and remains hidden from other objects.

Data Wrapping

If we look at the above example, we are using String as a data type, but it is also a Class by itself in Java. Again Student is a class, but when we create an object of it as Student S1, in this case we are defining a variable of datatype Student. In this case an object could be serving a dual purpose, be used as a data type as well as a Class.


In the Student class above we are binding the private variables name, rollNo, GPA with the functions. When we create an object of Student, it internally has functions and data that are being bound with each other. Encapsulation is process of the data and function binding together in one single entity. Think of it as the hood of the car, under which you have a whole lot of operations going on. So let's say I add a method computeGPA that takes in the student's scores for semesters and gives the output. You are using only one single Student object, internally that has methods which bind with variables to do the operation.


Now the client testing the Student class, will invoke the GPA method as shown. Student s1=new Student(); s1.computeGPA(2.2,4.4, 5.5). Here you have the method that internally computes the overall GPA and returns the final result. The user who is calling the method, does not get to see it's implementation nor the binding there, it only sees the method. Abstraction is process of hiding the implementation details, and exposing only the interface to the client.

share|improve this answer
add comment

Lemme try:

Data binding: this concept is not OOP specific, and it refers to the concept of connecting your data structures to interface forms. Not something that we typically mention when we talk about OOP.

Data hiding: what we're really talking about here is information hiding, which includes hiding data and code. Information hiding refers to keeping implementation details away from your interface, in order not to clobber the users of the code with irrelevant details. This lets you later change things around with reduced impact on the code users.

Data wrapping: the Adapter (Wrapper) design pattern, in which we hide data behind an interface to provide enhanced services. Here we're making a stronger statement than with data hiding, chiefly the idea of translating between two contracts.

Encapsulation: bundling code and data together in an object. Some people use this as a synonym for information hiding. See this for a distinction that I like.

Data abstraction: the use of an abstract data type, again to insulate users of the data from low level details, providing instead high level concepts. For example, a heap is implemented using an array, but a heap uses specific heap operations having little to do conceptually with an array. Instead of exposing the array naked, we hide it and expose a data type (a class in our case) that exposes heap-related functionality only. When you abstract data, you use data hiding as a tool.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.