Simplest Decorator Design Pattern in C#

Поделиться
HTML-код
  • Опубликовано: 18 окт 2024
  • Watch and learn a very simple code example about how to implement the Decorator Design Pattern in the C# programming language.
    ►►►Like this Video? Please be sure to SUBSCRIBE for more:
    www.youtube.co...
    ----------My Social Links:
    🔴 My Channel: / codefirst
    🔴 View Playlists: / codefirst
    🔴 My Github: github.com/Nitij
    #DecoratorPattern

Комментарии • 51

  • @jtjnash
    @jtjnash 2 года назад +1

    I looked at several explanations before watching this. Yours finally made it simple and easy to understand. Thank you.

  • @hocahaenyi7685
    @hocahaenyi7685 2 года назад +2

    Great video!!
    It may help that we reuse the variable "pizza" and keep re-assigning it to each decorator instance. It makes it clearer that "one thing" is being transformed through decorations.
    IPizza pizza = new Pizza();
    pizza = new CheeseDecorator(pizza);
    pizza = new TomatoDecorator(pizza);
    pizza = new OnionDecorator(pizza);
    ....

  • @IAmESG
    @IAmESG 3 года назад +7

    Amazing video, would love to see more, though I suggest that you add a UML diagram in the future.

  • @deepdarkguz9ka729
    @deepdarkguz9ka729 3 года назад +2

    It's very simple explanation, but also it's so useful, thanks for explanation!

  • @Oluciaano
    @Oluciaano 4 года назад +3

    the video was very good, it dealt with in a simple way, I missed UnitTest and how to do the injection depedency
    could you include these steps in the next videos?
    example using FluentAssertion.

  • @nandinik7816
    @nandinik7816 3 года назад

    This video gave the clear picture. Referring many sites didnt help me. Thanks a lot... Could you also provide videos on designing any architecture

  • @tharlinhtet97
    @tharlinhtet97 3 года назад

    Finally Eminem explained it very well. Thanks alot.

  • @charlesopuoro5295
    @charlesopuoro5295 Год назад

    Great Job. Thank you for this Charitable Endeavour.

  • @AriLetsPlays
    @AriLetsPlays Год назад

    Thanks for making this easier to understand!

  • @williamedstrom9575
    @williamedstrom9575 Год назад

    The simplicity is great for comprehension, but one question I still have is how to handle other methods not explicitly extended by the decorator.

  • @nascimentoalexandre
    @nascimentoalexandre 7 месяцев назад

    Man, you nailed it. If you can made me understand this, you're good at explanation! lol

  • @MrMattberry1
    @MrMattberry1 28 дней назад

    Great video, I prefer the builder pattern

  • @ahmedm_seada
    @ahmedm_seada Год назад

    thank you so much for this simple explanation.

  • @澳贼
    @澳贼 3 года назад

    nice and clean code, clear explanation. thanks.

  • @applicationtest4680
    @applicationtest4680 3 года назад

    Best explanation ! I've never had before Thanks so much

  • @krin3x93
    @krin3x93 3 года назад +1

    Can I also re use the variable "pizza" instead of creating new variables with differenet names and passing them? So that I can only have one instance of pizza being upgraded until It got passed through all decorators?

    • @devemfoco
      @devemfoco 3 года назад

      I think the same: adding decorators to pizza. At the end, call a pizza type, then show all itens added.

    • @dietrevich
      @dietrevich 2 года назад

      No, he needs to called then for what they are, toppings. That way the references in the code are clearer and understandable. He can use "toppings" for all three and leave pizza as pizza which is what it is.

  • @Myrelaxedlife
    @Myrelaxedlife 2 года назад

    That's pretty good. Thanks for the explanation.

  • @alreadytakenindeed
    @alreadytakenindeed 2 года назад

    Great and very clean video, thank you!

  • @DaveWalker_OakGames
    @DaveWalker_OakGames 3 года назад +1

    Quick and well explained, thanks!

  • @ivanfernandesgarcia6017
    @ivanfernandesgarcia6017 2 года назад

    Thanks for this video!

  • @prafulsinghvit
    @prafulsinghvit 3 года назад

    wow...what a nice pizza..!! I mean nice tutorial 😂. Keep it up ❤️

  • @sanelectro062
    @sanelectro062 3 года назад

    It was really simple.. Thank you

  • @luizalmeida1209
    @luizalmeida1209 4 года назад

    Wow, really clarified it to me, thanks!

  • @dietrevich
    @dietrevich 2 года назад

    Instead of calling each decorator reference by specific name, like onion decorator, cheese decorator, etc call them all "toppings" and that way you can interchange the order without having to change the references in their constructors.

  • @avonzo
    @avonzo Месяц назад

    This looks like inheritance. What if you want to "decorate" existing methods that you can't change?

  • @vernonvandermerwe3270
    @vernonvandermerwe3270 4 года назад +2

    This was an amazing example, Thank you so much man!!!!

  • @kuumaaa
    @kuumaaa 3 года назад

    nice and simple :p

  • @GergelyCsermely
    @GergelyCsermely 9 месяцев назад

    Thanks

  • @Chiramisudo
    @Chiramisudo 4 года назад

    What if I want to bundle that functionality into an Attribute so it's as simple as applying an Attribute to a Method and getting the functionality added?

    • @CodeRadiance
      @CodeRadiance  4 года назад

      Nice idea. Will have look into that.

    • @Chiramisudo
      @Chiramisudo 4 года назад

      @@CodeRadiance I look forward to seeing your results. 😉

    • @BB-Shorts_Edit
      @BB-Shorts_Edit 4 года назад

      @@CodeRadiance if you implemented with Attribute, plz share that video link

  • @yaolegoleynik
    @yaolegoleynik 4 года назад

    Thank you!

  • @JonahDominguez
    @JonahDominguez 4 года назад

    lol i got a bit confused for a moment when you started talking about pizza. i thought it was some programming term i had never heard of

  • @jimiwills
    @jimiwills 2 года назад +1

    ❤️🍕🧑‍💻

  • @orange_brat
    @orange_brat 3 года назад

    Great thanks

  • @BahawalTV
    @BahawalTV 4 года назад +1

    Good man.

  • @SharunKumar
    @SharunKumar 2 года назад

    Damn it, now I am craving for pizza

  • @TiborKoroknai
    @TiborKoroknai 3 года назад +2

    Who puts the cheese on the bottom? :D

  • @sumitsharma5537
    @sumitsharma5537 2 года назад

    Lit!

  • @vivekkaushik9508
    @vivekkaushik9508 2 года назад

    OOP is unnecessarily complicated. I haven't seen any real world implementation of most of these "patterns". Most devs either don't have time or expertise or even interest/enthusiasm to go around playing with objects. People just write code for work. OOP creates more problems than it promises to solve by creating more technical jargon.
    Composition > Inheritance. That's why JS wins.

    • @CodeRadiance
      @CodeRadiance  2 года назад

      Yeah js makes composition extremely easy to implement.

  • @bradleyr4451
    @bradleyr4451 3 года назад +1

    your first example spells decorator wrong