0
I don't understand the concept of OOP in most programming languages and Ruby is a pure OOP language.. Can someone please help?
OOP CONCEPT AND IDEA
3 Antworten
+ 7
OOP stands for Object-Oriented Programming. This means that the programming language works around separate objects, instead of having one big chunk of code. So, that way, you have individual, smaller bits of code thay you can mix, match, and move around easier.
+ 2
It's like a machine, in the concept that it can be modified by attaching parts, some could add to the machine a different way of handling things, or it could change what the purpose of the machine is in its entirety.
in BASIC, I used to use loops and iterations to always pass checks and results, constantly looping until a special condition(s) was met finally, which would circumvent the loop and end the program. That used a lot of memory clock. OOP is simpler because you don't need to constantly feed through checks in that way, you can write a method that defines what everything represents then use other scripts to perform the simple tasks, and how they flow when they're needed.
I'm not sure that makes sense, how I wrote it, but it makes sense to me. Also the other answers are better, mine just is to explain the ease of OOP vs Line based programming like BASIC. I enjoy the idea of Classes to clarify objectives, so it's clean when you are looking for specific method to behave in a manner when it's needed. Comments in the lines of code are also great for clarifying why certain things are put the way they are or explaining something to other programmers they might not notice, or something I probably won't remember about the code. Whenever I'm coding, I usually comment just about everything so my brain can see what the code is doing easier. I'll even comment code before I write it so that when I have problems I at least have the goal right in front of me. If I give up and walk away, I can come back later refreshed and keep working at it without wondering where I was going.
+ 1
How I think about OOP besides the very good textbook example given above, is a way of templating general properties(descriptions)/attributes(actions), that all objects will share. This is done for several reasons: your code will be easier 2 debug(fix), modify, understand when it gets larger.