Composition vs Inheritance Pro Tips

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ม.ค. 2025

ความคิดเห็น • 21

  • @skypravda
    @skypravda 4 ปีที่แล้ว +1

    Just found your channel, thanks !

  • @queellinn
    @queellinn 4 ปีที่แล้ว +2

    Loved this video 😊, thank you for this. I have a question and would be great if you or any can answer it. Is dependency injection a way of composition ?

    • @CodeRadiance
      @CodeRadiance  4 ปีที่แล้ว +1

      Yeah it should be if the dependency is being used to compose the object.

    • @kacerory3598
      @kacerory3598 3 ปีที่แล้ว

      i realize Im kind of randomly asking but does anybody know of a good website to watch new movies online?

    • @nelsonbodie1803
      @nelsonbodie1803 3 ปีที่แล้ว

      @Kace Rory flixportal =)

    • @kacerory3598
      @kacerory3598 3 ปีที่แล้ว

      @Nelson Bodie thanks, I went there and it seems to work =) Appreciate it!

    • @nelsonbodie1803
      @nelsonbodie1803 3 ปีที่แล้ว

      @Kace Rory happy to help :)

  • @lecturestofallasleepby5977
    @lecturestofallasleepby5977 4 ปีที่แล้ว +4

    Thank you for making this video. Lots of good content here, however, please don't teach that inheritance is better for code reuse. Consider that an object implementing an interface composed by one class may also be injected into any other class requiring an object which implements that same interface and thus the code is much MORE reusable than the inheritance code which can ONLY be reused by a derived object. Composed objects are more loosely coupled which makes them superior for reuse. Inheritance is ONLY really useful when you want to hard code shared behaviors for a hierarchy of objects.

    • @CodeRadiance
      @CodeRadiance  4 ปีที่แล้ว

      What you may be referring to is called dependency injection and is usually achieved using interface or class inheritance. Inheritance was introduced for code reusability and decoration. I believe it really depends upon the context and usage to determine which one is better for reusability but in my experience, inheritance is used much more than composition.

    • @sebastianschweigert7117
      @sebastianschweigert7117 3 ปีที่แล้ว +1

      @@CodeRadiance garbage advice

  • @sanjaysuman3216
    @sanjaysuman3216 4 ปีที่แล้ว +3

    Can you please make video on Aggregation/ Association

  • @FuzzyDPozzy
    @FuzzyDPozzy 4 ปีที่แล้ว

    6:44 that's not everything , you can make another 3-4 videos about composition nobody has many any really in dept good tutorials except from you.
    #1 Idea one: I would like to see a video about composition , when is better to use composition or when is better to use inheritance instead of compositions, so basically to see the difference between these two.
    #2 I would like to see composition more in terms of clean coding and by following the solid principles because some solid principles they use inheritance so it's kinda a bummer, a guy told me that we shouldn't always follow the solid principles we should learn when to use them and I would like to learn more about this. I know composition is really important and that's why i want to learn it.
    #3 I would like to see examples of short compositions like you did in this video.Idea would be about loading,inserting,deleting items from a list.
    #4 Basically tell us more about compositions through your own words and tips on how to use them , when to use them, why to use them.
    I know you could respond through a comment but as a fellow youtuber (this is not my main account i also make unity3d tutorials) I give you some ideas , because composition will be a thing people want to look up to , if you make some you may end up famous hehe and thank you so much for the tutorial i just subscribed! hopefully to see more!

    • @CodeRadiance
      @CodeRadiance  4 ปีที่แล้ว

      Since you went to such lengths to share your ideas, I just want to say that this is such a big topic that one video can never do justice for it. I will think about what you mentioned and maybe will expand more in future videos.
      Thank you for reviewing.

    • @FuzzyDPozzy
      @FuzzyDPozzy 4 ปีที่แล้ว

      @@CodeRadiance thank you i like when you put text on video to highlight and explain at the same time.
      If you have the time would you answer a couple of questions regarding this video?
      #1 "class object is assosiated with other class objects by means of its properties"
      by means of its properties do you mean Through its properties?
      #2at 0.57 can you write me a simple code example of implementing that diagram and say "This is for composition diagram" then "The interface diagram"
      #3 at 1:16 this is simple implmentation of composition right?
      #4 "Under inheritance a class is inherit from another class" by under you mean "In Inheritance" right?

    • @Reacton21
      @Reacton21 4 ปีที่แล้ว

      @@CodeRadiance will you keep making videos? its been a while since your last video.

    • @CodeRadiance
      @CodeRadiance  4 ปีที่แล้ว

      @@Reacton21 Soon my friend.

  • @elandrocaniela2886
    @elandrocaniela2886 4 ปีที่แล้ว +1

    Thx for your help.

  • @krishx007
    @krishx007 ปีที่แล้ว +1

  • @sankalparora9374
    @sankalparora9374 3 ปีที่แล้ว

    Nice and dandy!

  • @gurjar3609
    @gurjar3609 4 ปีที่แล้ว +1

    SIR YOUR VIDEO IS AMEZING I SEE YOUR UNREAL VIDEO BUT SIR I NEED YOUR HELP PLASE
    I BUY A CHARACTER FBX FILE AND I GIVE HIM SKIN BUT I DONT NO HOW I GIVE HIM EYE AND MOUTH PLASE SIR HELP ME🙏im struggling
    im sure you reply me

    • @CodeRadiance
      @CodeRadiance  4 ปีที่แล้ว

      What exactly is the issue? Materials, rigging, importing?