Thursday, December 4, 2014

Object Oriented Programming...

Objects are abstractions of processing James O. Coplien

As I mentioned earlier, For everything in the world of computer, there is a real world existence and this is being followed in Object Oriented Programming (OOP).

But what this actually means ?
It simply means, anything we want to do, has to be dealt with objects.

What is an Object ?
Anything you can see around, is an object. You PC, your mobile, your watch and you yourself...
Yes, all human beings are objects.

Basically, anything that has something to do is an object where you know, what to do with it but less interested in knowing how this does.
For example:

  1. You eat food, your body works. Except for the doctors, we are really not very much interested in how everything goes under the hood.
  2. You see your watch, it tells time. But rather than you are an watch mechanic, you are less likely to know how this works.
  3. You play cool games on your Android device but you are hardly bothered about how the game runs or how the touch even works.
That's it.

Now, let's put this into a formal definition in terms of Computer Programming.

Object: Object is the basic unit of OOP. An object has some fields(often known as variables) and some behaviors(often known as methods) bundled together in a single unit.

So, how am I an object by your definition ?
Not only you, I am also an object of Human Class defined by almighty creator of the universe. After some days working with Java, you yourself find the analogy and if you don't, comments are always welcome !!!

Now, we know what an object is. We are now going to know about another term, Class.

Class: This is the blueprint of the object. Means, it defines, what are the fields and behavior an object will have, what it will perform. You can think a class as a recipe, where food is the object.
The following picture depicts the relation of class and object.



Who is this JVM between my recipe and my fruit salad ?
We need to go deeper to know this person a bit. Trust me, he is very good for you and your recipe. And even sometimes he makes your recipe more delicious. For now, take him as your friend.

Next, we are going to know some more about OOP. Stay tuned.


Prev     Next
Palash Kanti Kundu

No comments:

Post a Comment