My mind is blown. Still really not sure what is going on, but I love the whole drawing component to this. Great job with the explanation! Watched your whole video to support!
Been trying to code web FE with JS for two years and it's the first time I can have some grasp of what OOP and Class mean. All thanks to your 6 mins vid. Buen trabajo!
Hello Christian, I think that in the example of the relationship (aggregation) between the car and the wheel classes, the hexagone must be in the car side
Picture a boat in your head. Got it? Okay, great! INHERITANCE What kind of boat did you picture in your head? Is it a 1 person sunfish? A yacht? A submarine even!? All of those are examples of boats. So say we want to write a program that will have a sunfish, a yacht, and a submarine in it. We could do this a few ways. We'd create classes for a sunfish and a yacht and a submarine. Sunfishes, yachts, and submarines all have attributes that they share since they are boats. They have a top speed. They have weight. They have maximum passenger counts. In each of our classes we could define these variables, but that means we'd write the same line of code over and over. In the sunfish class we'd create a variable called top speed, then in the yacht class we'd create a variable also called top speed. We'd do the same thing for the submarine. Then we'd have to do the same thing for weight and passengers. Basically, we'd write a lot of code! INSTEAD, we'll create a class called "BOAT" where we will define our variables to hold weight and top speed and passenger limits. Then when we create our yacht and our sunfish classes, we'll tell those classes to inherit from the "BOAT" class. What this means is that they will automatically have variables defined in the BOAT class in them already! If we use this method, we can create all different types of boats simply by creating new classes and inheriting from the base class of "BOAT" without having to write all new code! We could make ocean liners, jet skis, etc. ENCAPSULATION This one is REALLY simple. This means that an object that exists in your program should only be able to control itself and nothing else unless EXPRESSLY stated. Boat A should be able to tell itself to propel through the water but it shouldn't be able to control what Boat B does. Boat B has to take care of itself. If there is a piece of code in the BOAT class that tells itself to move we can either make it private or public (there are others but don't worry about it for now). Private means that only the Boat can tell itself to move. Public means that ANY object can tell that boat to move. Boat A telling Boat B to move doesn't make sense. Boat B should have sole control over itself and nothing else! Polymorphism Say we have a program that is simulating a lot of different boats. At the beginning of the program all the boats are stationary and when we click the start button all the boats in the water start moving. There are many different types of boats in our simulation: yachts, submarines, sunfishes, ocean-liners, etc. To have all the boats "go" when the user clicks the start button we can write this two ways: One would be to tell each object individually to "go" which would look something like this. Sunfish -> Go! Ocean-Liner -> Go! Submarine -> Go! YachtA -> Go! YachtB -> Go! Notice that we have two yachts. I have to call those yachts individually and tell them to go. What if our program has hundreds or THOUSANDS of boats. That's a lot of code!!! Instead, we use POLYMORPHISM to make things much simpler! Remember from inheritance, yachts, submarines, sunfishes, ocean-liners, they are all boats! Our code to tell all the boats to move could be something like this: Get a list of all the objects that inherit from the base class BOAT. Use a loop to go through each boat in that list and tell it to go! In this case, we're telling each boat to go based on them all being a boat. We don't care what type of boat it is. If it's a boat then we tell it to go!
no, they are not the same. Procedural is imperative paradigm while logical is another one (see 1:11). I don't explain the logical paradigm in this video :( but you can read more about it here: en.wikipedia.org/wiki/Logic_programming
Not sure I understand your question. In general the idea of abstraction is to think on higher level "stuff" that simplifies thinking on detailed issues.
My mind is blown. Still really not sure what is going on, but I love the whole drawing component to this. Great job with the explanation! Watched your whole video to support!
Thank you!
Been trying to code web FE with JS for two years and it's the first time I can have some grasp of what OOP and Class mean. All thanks to your 6 mins vid. Buen trabajo!
Oh me alegro! Si tienes alguna sugerencia de vídeo no dudes en comentarla :)
Very clean and straightforward, keep the good work!
Thanks! 😁
awesome.... each and everything is valuable and it is a million dollar lecture
Glad to hear that!
Hello Christian, I think that in the example of the relationship (aggregation) between the car and the wheel classes, the hexagone must be in the car side
Yeah you are right. I have a UML bug in my video 😅 well spotted!
Amazing video! Short and clear!
What software did you use to draw your diagrams?
MyPaint in Linux:)
Picture a boat in your head. Got it? Okay, great!
INHERITANCE
What kind of boat did you picture in your head? Is it a 1 person sunfish? A yacht? A submarine even!? All of those are examples of boats. So say we want to write a program that will have a sunfish, a yacht, and a submarine in it.
We could do this a few ways. We'd create classes for a sunfish and a yacht and a submarine. Sunfishes, yachts, and submarines all have attributes that they share since they are boats. They have a top speed. They have weight. They have maximum passenger counts. In each of our classes we could define these variables, but that means we'd write the same line of code over and over. In the sunfish class we'd create a variable called top speed, then in the yacht class we'd create a variable also called top speed. We'd do the same thing for the submarine. Then we'd have to do the same thing for weight and passengers. Basically, we'd write a lot of code!
INSTEAD, we'll create a class called "BOAT" where we will define our variables to hold weight and top speed and passenger limits. Then when we create our yacht and our sunfish classes, we'll tell those classes to inherit from the "BOAT" class. What this means is that they will automatically have variables defined in the BOAT class in them already! If we use this method, we can create all different types of boats simply by creating new classes and inheriting from the base class of "BOAT" without having to write all new code! We could make ocean liners, jet skis, etc.
ENCAPSULATION
This one is REALLY simple. This means that an object that exists in your program should only be able to control itself and nothing else unless EXPRESSLY stated. Boat A should be able to tell itself to propel through the water but it shouldn't be able to control what Boat B does. Boat B has to take care of itself. If there is a piece of code in the BOAT class that tells itself to move we can either make it private or public (there are others but don't worry about it for now). Private means that only the Boat can tell itself to move. Public means that ANY object can tell that boat to move. Boat A telling Boat B to move doesn't make sense. Boat B should have sole control over itself and nothing else!
Polymorphism
Say we have a program that is simulating a lot of different boats. At the beginning of the program all the boats are stationary and when we click the start button all the boats in the water start moving. There are many different types of boats in our simulation: yachts, submarines, sunfishes, ocean-liners, etc. To have all the boats "go" when the user clicks the start button we can write this two ways:
One would be to tell each object individually to "go" which would look something like this.
Sunfish -> Go!
Ocean-Liner -> Go!
Submarine -> Go!
YachtA -> Go!
YachtB -> Go!
Notice that we have two yachts. I have to call those yachts individually and tell them to go. What if our program has hundreds or THOUSANDS of boats. That's a lot of code!!!
Instead, we use POLYMORPHISM to make things much simpler! Remember from inheritance, yachts, submarines, sunfishes, ocean-liners, they are all boats! Our code to tell all the boats to move could be something like this:
Get a list of all the objects that inherit from the base class BOAT.
Use a loop to go through each boat in that list and tell it to go!
In this case, we're telling each boat to go based on them all being a boat. We don't care what type of boat it is. If it's a boat then we tell it to go!
Well explained and a good help for new and experienced devs
Awesome! Glad you liked it! Thanks!
0:39 Is it logical paradigm as well as procedure paradigm sir?
no, they are not the same. Procedural is imperative paradigm while logical is another one (see 1:11). I don't explain the logical paradigm in this video :( but you can read more about it here: en.wikipedia.org/wiki/Logic_programming
hi frd im your recent like ...💖💖💖AIG DESIGNERS.💖💖💖...your videos are realy awsome...stay connect my friend....💖💖💖
..
Thank you! For sure!
Abstraction in oops means hiding the complexity of the code ryt ? I didn't understood your explanation
Not sure I understand your question. In general the idea of abstraction is to think on higher level "stuff" that simplifies thinking on detailed issues.