Don't worry if you don't understand it. I've been at it for years and I still don't understand it thoroughly. The more you think about it, the better at it you become. There is one thing for sure, the more you understand about it, the better a programmer, or engineer, you will be. What we implement in computer software is drawn from the real world, and the real world is a part of the universe, and the universe consists of objects, and objects 'want' to expend energy as fast as possible, and that's why we have OOP.
Introduction to object oriented programming...
There are many objects in the universe. In a particular context (which may be as wide as a given human brain will allow), any particilar object is an instance of a type (class) of object. Would you agree? Don't answer yet. Think about it over a few days.
An object has attributes. For example, the LP object that I am currently listening to has the attributes: artist, numberOfTracks, genre, ...
But the universe cannot just hold one copy (instance) of each object. That would be really boring. Therefore, the universe has many copies of each object, and so we have classes of objects. Take a further few days to think about this. What attributes does a planet have? How many instances of the 'Planet' class are there in the universe? That is, how many 'Planet' objects are there in the universe?
All objects of a class have the same attributes, but the values of these attributes are different. For example, I have about 250 instances (objects) of the LP class, all with the same attributes (artist, numberOfTracks, genre, etc.), but with various values. For example, tonight I have listened to three objects (instances) of the LP class...
1 2 3 4 5
|
class LP
attributes
artist
numberOfTracks
genre
|
The individual objects within tonight's musical entertainment looked something like this...
1 2 3 4 5 6 7 8 9 10 11 12
|
LP
artist
|
numberOfTracks ---> 9
genre ---> "Heavy metal"
LP
artist ---> "abba"
numberOfTracks ---> 19
genre ---> "Pop"
LP
artist ---> "The Carpenters"
numberOfTracks ---> 17
genre ---> "Pop" |
There were also a few instances of the 'Bottle' class which I consumed tonight. While these were all different instances (objects) of the Bottle class, their sets of attribute values were all exactly the same.
Sadly though, there will be only one instance of the 'Woman' class that I will be sleeping beside tonight, and her attributes are not worth bragging about I can assure you, but I am hoping that I've had enough instances of the 'Bottle' class to obscure them.
Moving swiftly on, we can use these observations to emulate the real world with electronics, by writing computer programs (i.e. programmes, procedures, ).
Please do not forget that I stipulated "a particular context" for object oriented thoughts.
There is far too much to this very complicated subject than can be explained by some dancing, drunken, sex-starved, Judge Judy-loving, d-head like moi. So get outa here and offa the web, and get yourself into academia. That is, enrol on to some degree courses and increase your chances of meeting some people who have spent their lives thinking about this sort of thing.
They're amazing.
Dave