Composite Design Pattern (C#)

Поділитися
Вставка
  • Опубліковано 1 чер 2024
  • The composite design pattern explained with examples in code.
    Patreon 🤝 / raw_coding
    Courses 📚 learning.raw-coding.dev
    Shop 🛒 shop.raw-coding.dev
    Discord 💬 / discord
    Twitter 📣 / anton_t0shik
    Twitch 🎥 / raw_coding
    Playlist: • c# design patterns
    Source: github.com/raw-coding-youtube...
    #csharp #composite #designpatterns

КОМЕНТАРІ • 23

  • @pradeepdm6972
    @pradeepdm6972 3 роки тому +5

    Channels like these is why I pay my broadband bills❤️.
    Thanks brother.
    Got what I was looking for.

  • @nicolasfilizzola2443
    @nicolasfilizzola2443 2 роки тому +2

    Thank you for all of the design pattern videos, it's been very helpful for studying for my test :))

  • @joshuajones02
    @joshuajones02 3 роки тому +1

    Thanks for the video!

    • @RawCoding
      @RawCoding  3 роки тому

      Thank you for watching

  • @stefanioan7569
    @stefanioan7569 3 роки тому +1

    Great video, as always 👍

  • @rafaspimenta
    @rafaspimenta Рік тому

    Your channel is a gem! Which book have you read about design patterns?

  • @SuperEvoken
    @SuperEvoken 2 роки тому +1

    i'm learning a ton from you.

  • @priyanshu4016
    @priyanshu4016 2 роки тому +2

    Very nice explain . but some what i feel lost in the example and missed the actual usage and applicability of the pattern.
    may be you can explain by taking example of sending mails as we can send mail to single user and group of users which having same functionality i.e send
    and group can contains nested group and members .

    • @RawCoding
      @RawCoding  2 роки тому +1

      Eya, sorry the example didn’t help. Maybe one of these: Product Trees (table has legs, bolts etc...), Element Trees (html, xml elements contain other elements) permissions (build up bigger permissions out of smaller ones and re use bigger ones to build up even bigger permissions)

  • @Eugene.g
    @Eugene.g 3 роки тому +2

    Матрёшка pattern! Hope you got Babushka pattern too

    • @RawCoding
      @RawCoding  3 роки тому +1

      haha no babushka pattern sorry :P

  • @TheNorthRemember
    @TheNorthRemember 2 роки тому +1

    when i create the composite class that returns a list of itself without interface it gives StackOverflow exception and i understand it's normal,, however, when the class implements interface like your example it doesn't throw the exception why??
    i noticed that when using interface the list children would be created when they are called like lazy loading! so I think this is the reason,, but again why it's lazy loading when using interface ??

    • @RawCoding
      @RawCoding  2 роки тому +1

      You'll need to show code example of what you are doing, an object referencing another object of same type shouldn't be a problem. Perhaps you are using static fields?

    • @TheNorthRemember
      @TheNorthRemember 2 роки тому +1

      @@RawCoding literally like what you did in your linqpad, the result windwo has list representation and when you expand the child it has another list over and over.. this is the behavior I ask about why it doesn't give exceptions? try to remove the interface next to class name then the exception occurs

    • @RawCoding
      @RawCoding  2 роки тому +1

      Make sure you are passing a new instance and now the same instance so you’ll have a circular reference

  • @clearlyunwell
    @clearlyunwell 3 роки тому +1

    👍🏽

  • @hadibazmi6340
    @hadibazmi6340 2 роки тому +1

    U are a masochist 😁