The Object is at the heart of Object Oriented programming
Obviously, Object Oriented programming is about objects. But what is an object?
There lots of definitions of an object and may of them are wrong.
In the article on Encapsulation I mentioned that an object usually contains both data and behaviour. And that is true. But it isn't always true. There are some objects with no behaviour. For example a Data Transfer Object has no behaviour, it is used purely to transfer data around the application. But this is a special and unusual case.
Objects are usually used to model the real world. For example a customer object will model a real-life customer.
The best definition I have seen of an object comes from Steve McConnell in his book Code Complete. McConnell defines an object like this
An object is an abstract data type
That may not help much at first. But if you read the article on Abstraction you will understand the abstract bit.
What about data type?
All computer programs use data. Data is usually arranged into various types, such as integer, double, string, etc. A program will assign a variable to a particular data type and then pass it around the program. Similarly, an object can be thought of as another data type, and it too can be passed around the program.
And that is where the power of objects come in.
In a functional program you might create an invoice. You need data from the customer table, the inventory table, perhaps a price table, and invoice table and an invoice items table. You then put them all together and create an invoice. The next time you want to look at that invoice you have to do it all over again. With OO you create the invoice object and pass it around to your heart's content.
Moreover, once it is created you can forget about it. It is a black box to you. It operates as a single unit and the internals need not concern you ever again.
This makes for more efficient programming and less scope for errors.
Cats regard people as warmblooded furniture.