obasan Posted April 8, 2017 Share Posted April 8, 2017 Done with the basics and now I'm on to the big boy stuff (OOP) Can someone eli5 encapsulation, inheritance, polymorphism, and abstraction... Or provide some good material that will explain it in great detail to a complete noob & beginner Quote Link to comment Share on other sites More sharing options...
Final Posted April 8, 2017 Share Posted April 8, 2017 https://docs.oracle.com/javase/tutorial/java/ 2 Quote Link to comment Share on other sites More sharing options...
Eliot Posted April 8, 2017 Share Posted April 8, 2017 https://www.ntu.edu.sg/home/ehchua/programming/java/J3a_OOPBasics.html 2 Quote Link to comment Share on other sites More sharing options...
Alek Posted April 8, 2017 Share Posted April 8, 2017 Inheritance 101: interface Animal { int getAge(); } class Dog implements Animal { int getBarks(); } class Cat implements Animal { int getWhiskers(); } Dog doggo = new Dog(); doggo.getAge(); doggo.getBarks(); Cat cate = new Cat(); cate.getWhiskers(); cate.getAge(); 2 Quote Link to comment Share on other sites More sharing options...
Alvin Posted April 8, 2017 Share Posted April 8, 2017 All these links and not a single ELI5 Let me take a shot at this dad. So encapsulation and abstraction is very similar. It is kind of like putting a part of the program into a container, it limits the scope of the program and the information that can be obtained by the program. Why is this important? Well, for encapsulation, private components of your program are should only affect certain parts of your program and should not go beyond that. For abstraction, it is hiding the details of the program to the user. For example, let's take an example of a person who deals cheese of the street (cheese is good). All you want is the cheese, the dealer has a billion small characteristics to him that are unnecessary and are better off not knowing. All you really need to know is the price of the cheese and how to pay him, simple. Inheritance is similar to real life. Let's take the example that all llamas are mammals. It is inherent to all mammals that they have fur, are vertebrates, are warmblooded and endothermic, etc etc. The same is true with llamas and all other mammals, they all have these characteristics. But llamas also have unique characteristics that distinguish them, their look, how they sound, and their overall majestic aura. So imagine mammals is the superclass (like the parent), and the llama program is the subclass. You would define the characteristics of the superclass and the subclass would automatically have these traits by extending the superclass and more if you add them. There's more to it, but the easiest way to understand it is to first understand the relationship between objects. Polymorphism is an odd subject, the big one that I think you really need to know is subtype polymorphism. Essentially, you can logic this out.. If A is a subtype of B, an A can do anything a B can do. So let's take the example of the llama. If all mammals have the ability to make milk for its offspring, then conversely llamas can make llama milk for its babies as well. But you can't go the other way around, not all mammals can be as majestic as llamas. I'm typing on my phone so idek if i'm right, somebody correct me if i messed up but this is the basic parts of the concepts you asked for ^_^ GL learning, it's not that bad once you get into it. 1 Quote Link to comment Share on other sites More sharing options...
liverare Posted April 9, 2017 Share Posted April 9, 2017 Programming has a whole bunch of funny names for stuff, but it's actually so simple and Alek's post pretty much wraps it in a nut-shell. But there's a back story which'll give you a better understanding for why we need OOP. The short-and-sweet is: Computers aren't OOP. They beep and they boop as they process one instruction at a time in their machine language. Computers can't OOP without memory. Memory lets the computer store 1's and 0's in such a way as to keep the info intact for as long as needed. Machine code referrers to that chunk of memory as many times at called. The machine language/lower level languages can't OOP. But languages built on-top of those can and do. 1 Quote Link to comment Share on other sites More sharing options...
obasan Posted April 10, 2017 Author Share Posted April 10, 2017 On 4/8/2017 at 2:10 PM, Alek said: Inheritance 101: interface Animal { int getAge(); } class Dog implements Animal { int getBarks(); } class Cat implements Animal { int getWhiskers(); } Dog doggo = new Dog(); doggo.getAge(); doggo.getBarks(); Cat cate = new Cat(); cate.getWhiskers(); cate.getAge(); didn't understand shit LMAO. jk i get about 70% of it... nonetheless, i'll continue learning and one day i'll restore botting to its former glory! Quote Link to comment Share on other sites More sharing options...
obasan Posted April 12, 2017 Author Share Posted April 12, 2017 On 4/8/2017 at 1:58 PM, Eliot said: https://www.ntu.edu.sg/home/ehchua/programming/java/J3a_OOPBasics.html bookmarked this beast for later Quote Link to comment Share on other sites More sharing options...