Lonely Tylenol
First Post
So over in this thread someone mentioned object-oriented programming. It reminded me that I wanted to figure out what the heck this is, not being a programmer, but being tech-savvy enough that I feel as though I have a hole in my overall picture of things.
My brief encounters with discussion of the subject is that object oriented programming is essentially reduction of what a traditional programming paradigm would call subroutines to something like modular program-lets called classes. So if you have a class called LeftHand, it performs functions for the overall system that would be different than the classes Mouth and Eye. But these fit together in such a way as to create a whole that can respond to inputs by sending them off to the various classes for processing.
A class has behaviours that are either particular to the class, or shared by different classes. So while the class Eye would have a look() behaviour, LeftHand would not. But both LeftHand and RightHand would both have grasp() behaviours, and a general call to the classes to perform grasp() would cause both LeftHand and RightHand to attempt to perform this behaviour. You could also ask LeftHand to grasp(), but not RightHand, if you want to be more specific about it.
Then there's inheritance, which is basically grouping of classes. LeftHand and RightHand are both members of the group Hands, and so anything that affects all Hands will affect these two classes.
Essentially, the basis for object-oriented programming seems to be to divide things into functional units, which can then be stacked, organized, and set to work on one another without the need for a central line of programming with subroutines attached.
Am I correct in my interpretation of the paradigm, and is there anything critical that I should add? Programmers, educate me.
My brief encounters with discussion of the subject is that object oriented programming is essentially reduction of what a traditional programming paradigm would call subroutines to something like modular program-lets called classes. So if you have a class called LeftHand, it performs functions for the overall system that would be different than the classes Mouth and Eye. But these fit together in such a way as to create a whole that can respond to inputs by sending them off to the various classes for processing.
A class has behaviours that are either particular to the class, or shared by different classes. So while the class Eye would have a look() behaviour, LeftHand would not. But both LeftHand and RightHand would both have grasp() behaviours, and a general call to the classes to perform grasp() would cause both LeftHand and RightHand to attempt to perform this behaviour. You could also ask LeftHand to grasp(), but not RightHand, if you want to be more specific about it.
Then there's inheritance, which is basically grouping of classes. LeftHand and RightHand are both members of the group Hands, and so anything that affects all Hands will affect these two classes.
Essentially, the basis for object-oriented programming seems to be to divide things into functional units, which can then be stacked, organized, and set to work on one another without the need for a central line of programming with subroutines attached.
Am I correct in my interpretation of the paradigm, and is there anything critical that I should add? Programmers, educate me.