Page 1 of 1 [ 3 posts ] 

K_Kelly
Veteran
Veteran

User avatar

Joined: 18 Apr 2014
Age: 32
Gender: Male
Posts: 1,452

04 Jun 2016, 3:06 pm

For example, I can't seem to grasp on the concept of "Object-oriented programming" when trying to learn certain programming languages. I just don't understand what it means when they say that programs are like objects. This applies to other concepts in other fields besides computers and programming.

How do I get my brain to better register what a certain concept is? What is going on with my brain that makes certain terms and concepts so hard to register at first?



BaalChatzaf
Veteran
Veteran

User avatar

Joined: 11 Mar 2008
Gender: Male
Posts: 1,050
Location: Monroe Twp. NJ

05 Jun 2016, 5:12 pm

K_Kelly wrote:
For example, I can't seem to grasp on the concept of "Object-oriented programming" when trying to learn certain programming languages. I just don't understand what it means when they say that programs are like objects. This applies to other concepts in other fields besides computers and programming.

How do I get my brain to better register what a certain concept is? What is going on with my brain that makes certain terms and concepts so hard to register at first?


The gist of object oriented programming is to keep the interfaces of the various modules and subsystems separate from their internal works. That way the user need only know how to invoke the object. Which means if the object is modified internally, as long as the interfaces and protocols are retained, the user does not have to worry about the changes made to the object, as long as it keeps on doing what it is contracted to do.

If the user incorrectly invokes the object with a bad protocol are a bad data type the object merely goes bzzzzt. Whereas with a normal subroutine if you pass a bad data type to it, unpredictable things could happen.


_________________
Socrates' Last Words: I drank what!! !?????


izzeme
Veteran
Veteran

User avatar

Joined: 4 Apr 2011
Age: 37
Gender: Male
Posts: 2,665

06 Jun 2016, 7:33 am

Learning new concepts is a skill, keep trying and you will get better.

As for object orientated programming; the idea is that every task is kept seperate, it is also named "black box programming" for that reason.
You write a program, which gives tasks to another program and gets a result back, without knowing what is happening in the other place.
For example: you want to solve a polinomal equation; and at some point tou give a number A to the box "square root", which returns a number B back to you, and you go go on using that.
At a different time (earlier or later, you write program "square root", which receives A from any other program, takes the root and gives the result B back, without knowing (or even caring) who/what asked him to take a root