We all very well know about object oriented programming. But most people have limited knowledge about objects. What are objects really? Let us understand it here.
In real world we understand about objects well. All of us are human beings. Each person is a human first. Then a person has a religion. The person can be a Christian, Hindu, Muslim Or Jew etc. Then a person can be a male or a female. Then a person is of certain age. Then a person has some specific education like a college degree etc. Then a person has some specific skills like plumbing, painting etc. Then a person can have a family. The person may have fallen sick many times in its life and so will have a medical history. Then a person may have been working and will have a job history.
In fact, there is going to be too much information about a person. If all this information can be stored by writing books then there can be thousands of books just for storing all the information related to just one person!
When it comes to programming, storage of data related to one entity (e.g. a person) becomes a challenge. What if information about one person is attributed to some other person by mistake? For example, if a crime is attributed to the wrong person due to mistake in data, then the other person will get punished for none of its fault.
So it is important to attribute information about an entity correctly so that no wrong can happen to the other entity by mistake. A software program is used by a large number of people. A software program can be used to store information about thousands of people. How to ensure that each piece of data about each entity is correctly computed and stored?
Here comes the concept of objects. In object oriented programming, all the data about each object is directly linked to the object itself. Even the activities which an entity is currently performing (e.g. doing exercise or traveling etc.) is also directly linked to the object. This ensures that data related to an object (entity) is linked correctly and so there are no mistakes.
We will learn more about objects in out next post.