Object Oriented Programming Explained in a Nutshell

Sdílet
Vložit
  • čas přidán 12. 09. 2024

Komentáře • 23

  • @exploreaswego
    @exploreaswego Před 4 lety +3

    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!

  • @FacundoTroitero
    @FacundoTroitero Před 2 lety +1

    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!

    • @ADevStory
      @ADevStory  Před 2 lety

      Oh me alegro! Si tienes alguna sugerencia de vídeo no dudes en comentarla :)

  • @jesuskraisnik
    @jesuskraisnik Před 3 lety +2

    Very clean and straightforward, keep the good work!

  • @DebasmitSamal294
    @DebasmitSamal294 Před 3 lety +1

    awesome.... each and everything is valuable and it is a million dollar lecture

  • @anask9942
    @anask9942 Před 2 lety +1

    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

    • @ADevStory
      @ADevStory  Před 2 lety

      Yeah you are right. I have a UML bug in my video 😅 well spotted!

  • @dr_itchy
    @dr_itchy Před rokem

    Amazing video! Short and clear!
    What software did you use to draw your diagrams?

  • @RR-et6zp
    @RR-et6zp Před 2 lety +1

    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!

  • @beeldy8238
    @beeldy8238 Před 4 lety

    Well explained and a good help for new and experienced devs

    • @ADevStory
      @ADevStory  Před 4 lety

      Awesome! Glad you liked it! Thanks!

  • @adipurnomo5683
    @adipurnomo5683 Před 3 lety +1

    0:39 Is it logical paradigm as well as procedure paradigm sir?

    • @ADevStory
      @ADevStory  Před 3 lety

      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

  • @AADHIRAINTERIORS1908
    @AADHIRAINTERIORS1908 Před 4 lety +1

    hi frd im your recent like ...💖💖💖AIG DESIGNERS.💖💖💖...your videos are realy awsome...stay connect my friend....💖💖💖
    ..

  • @harinderchoudhary6259
    @harinderchoudhary6259 Před 2 lety

    Abstraction in oops means hiding the complexity of the code ryt ? I didn't understood your explanation

    • @ADevStory
      @ADevStory  Před 2 lety

      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.