Combine Design Patterns To Reveal Their Greatest Power

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ก.ค. 2023
  • Become a patron and download the source code: / source-code-for-86063807
    Discover the power behind design patterns in a way you've never seen before! It's no surprise that using design patterns on their own can bring benefits to your design. But when they are combined, a truly powerful transformation in the way we approach class design can be witnessed.
    In this video, you will see different design patterns in action, patterns like Null Object, Composite, and Decorator, to name a few. Each of these patterns will bring benefits to the design. But that benefit will always be limited to the case where the design pattern is applied. That is where a new force comes to the table.
    With a clever mix of these patterns, we create an intricate architecture, one that's capable of handling various scenarios. The charm truly unfolds when you notice the impact of combining two or more different design patterns, such as Decorator and Composite, or when adding Null Object to the mix. The most powerful design which you will witness in this demo is that in which the Factory Method pattern is implemented to combine objects implementing other patterns. The possibilities are endless, limited only by your design skills.
    Start creating designs that are better, more flexible, and faster. Take the first step on this journey and learn how to combine design patterns in a single, unified design.
    Thank you so much for watching! Please like, comment & share this video as it helps me a ton!! Don't forget to subscribe to my channel for more amazing videos and make sure to hit the bell icon to never miss any updates.🔥❤️
    ✅🔔 Become a patron ► / zoranhorvat
    ✅🔔 Subscribe ► / @zoran-horvat
    ⭐ Learn more from video courses:
    Beginning Object-oriented Programming with C# ► codinghelmet.com/go/beginning...
    ⭐ Collections and Generics in C# ► codinghelmet.com/go/collectio...
    ⭐ Making Your C# Code More Object-oriented ► codinghelmet.com/go/making-yo...
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    ⭐ CONNECT WITH ME 📱👨
    🌐Become a patron ► / zoranhorvat
    🌐Buy me a Coffee ► ko-fi.com/zoranhorvat
    🗳 Pluralsight Courses ► codinghelmet.com/go/pluralsight
    📸 Udemy Courses ► codinghelmet.com/go/udemy
    📸 Join me on Twitter ► / zoranh75
    🌐 Read my Articles ► codinghelmet.com/articles
    📸 Join me on LinkedIn ► / zoran-horvat
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    👨 About Me 👨
    Hi, I’m Zoran, I have more than 20 years of experience as a software developer, architect, team lead, and more. I have been programming in C# since its inception in the early 2000s. Since 2017 I have started publishing professional video courses at Pluralsight and Udemy and by this point, there are over 100 hours of the highest-quality videos you can watch on those platforms. On my TH-cam channel, you can find shorter video forms focused on clarifying practical issues in coding, design, and architecture of .NET applications.❤️
    ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
    ⚡️RIGHT NOTICE:
    The Copyright Laws of the United States recognize a “fair use” of copyrighted content. Section 107 of the U.S. Copyright Act states: “Notwithstanding the provisions of sections 106 and 106A, the fair use of a copyrighted work, including such use by reproduction in copies or phono records or by any other means specified by that section, for purposes such as criticism, comment, news reporting, teaching (including multiple copies for classroom use), scholarship, or research, is not an infringement of copyright." This video and our youtube channel, in general, may contain certain copyrighted works that were not specifically authorized to be used by the copyright holder(s), but which we believe in good faith are protected by federal law and the Fair use doctrine for one or more of the reasons noted above.
    ⭐For copyright or any inquiries, please contact us at zh@codinghelmet.com
    #designpatterns #csharp #dotnet
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @LordErnie
    @LordErnie ปีที่แล้ว +16

    This man is legendary. Manages to explain toppics like they are the most logical thing in the world. You have my respect

  • @peep39
    @peep39 3 หลายเดือนก่อน +1

    Love this style of video and teaching. You have made me a fan.

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

    Been around since your first video and I love that more and more people are coming across your channel!

  • @vulcanobyte
    @vulcanobyte ปีที่แล้ว +8

    The best C# videos ❤

  • @rustamhajiyev
    @rustamhajiyev ปีที่แล้ว +5

    🤤 - me watching Zoran's videos

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

    Thanks Mr. Zoran Horvat

  • @OscarAgreda
    @OscarAgreda 8 หลายเดือนก่อน +1

    Fantastic video! The way you showcased the combination of design patterns truly opens the potential of intricate architectures. I'd like to see a follow-up video on the Interpreter pattern. I believe it can serve as a "command center" for controlling and managing the various combined design patterns, further enhancing the power of the designs you've demonstrated here. The Interpreter pattern could provide a centralized mechanism to interpret and execute commands, making the combination of patterns even more dynamic and powerful. Keep up the great work, and I'm eagerly awaiting more content from you!

  • @mehdi_aghaei_
    @mehdi_aghaei_ ปีที่แล้ว

    Requirements in software development comes over time, the idea is pretty neat that you improve your design while developing but in production when they push for the fast out come it’s going to be hard to find these improvements. Thank you for giving us software engineering insights.🙏🏻

    • @zoran-horvat
      @zoran-horvat  ปีที่แล้ว +1

      I remember projects where I was investing more effort in bringing the customers and management to reason than writing actual code, precisely for the reason you stated.

  • @user-bm8gk7zw2f
    @user-bm8gk7zw2f ปีที่แล้ว +3

    First of all, awesome video and really like the functional approach.
    If you always wrap the ParallelDiscount in a RelativeDiscountCap then the flattening won't work without accounting for it... or am I missing something?

    • @zoran-horvat
      @zoran-horvat  ปีที่แล้ว +2

      You are right! The final method indeed requires some refining.

  • @bogdanpavlovic3456
    @bogdanpavlovic3456 ปีที่แล้ว

    🍺🍺🍻🍺🍺 ziveli legendo & svaka cast na smernosti!

  • @danielschmitt5750
    @danielschmitt5750 11 หลายเดือนก่อน +2

    Thank you for your videos. To me they are very entertaining and at the same time i am learning a lot. I wonder what your opinion is on the cost of abstraction and indirection that arises when applying a pattern. Specifically i am talking about a potential performance hit (i don't know if this is actually the case in C#) and the additional cognitive load for people that are not familiar with specific design patterns. My personal experience is that it is easier for new and inexperienced collegues if the code is simple and imperative. The code doesn't turn out to be as beautiful as yours but we had good experiences with this in the past.

    • @zoran-horvat
      @zoran-horvat  11 หลายเดือนก่อน +1

      Those are the good questions.
      When speaking of performance, a few microseconds lost on added indirections or garbage collection are meaningless in the face of much longer delays incurred by the storage and network. So long as the complexity of code remains equal (e.g. not substituting an O(1) algorithm with one with O(n) time complexity), there will be no measurable penalty from applying a richer model.
      The question about code complexity and abstract models is also interesting. While I can agree that less experienced programmers could cope better with simpler code structure, the reasons for abstraction lie elsewhere. An imperative implementation, that does not rely on object substitution and composition, will soon hit the limit where implementing a request becomes humanly impossible, not even at the cost of code explosion.
      The sooner they learn the virtues of polymorphism, the better for them. I'm not fond of hiding that under the scrutiny of their inexperience. There is good and bad programming and each programmer must learn the good parts early in their career.

    • @danielschmitt5750
      @danielschmitt5750 11 หลายเดือนก่อน +1

      @@zoran-horvat thank you for the quick response and thanks again for sharing your knowledge with us.

  • @ghostnguyen
    @ghostnguyen ปีที่แล้ว

    Hi Mr. Zoran,
    In previous video, you example only ChainedDiscounts.
    In this video, you example only ParalleDiscounts.
    Have you try combine both of them which is highly practical requirement?

    • @zoran-horvat
      @zoran-horvat  ปีที่แล้ว

      Yes, it is possible to combine them - either to chain parallel discounts, or to apply chained discounts in parallel. Other combinations are also possible that include other types of discounts.
      Each concrete class is implementing one concrete principle, so that you can create any structure at runtime that you want.

    • @ghostnguyen
      @ghostnguyen ปีที่แล้ว

      @@zoran-horvat Have you try it? With your code in the video, it it impossible or will be wrong result.

    • @zoran-horvat
      @zoran-horvat  ปีที่แล้ว

      @@ghostnguyen What is wrong with the result?

    • @ghostnguyen
      @ghostnguyen ปีที่แล้ว

      @@zoran-horvat Have you try it?

  • @LordErnie
    @LordErnie ปีที่แล้ว

    Question, isn't it dangerous using factories like that? Code represents many things, including communication. Isn't it dangerous to return wrapped objects from a factory if the user expects something else then what they get? If I call a factory on a type in the way that you are doing in the example, my first instinct would say that I get back an object of ParralelDiscount(s). I am in no way saying that it is bad, but to me it introduces a certain vagueness into the code. Is there a logical way to do the same thing, but without wrapping types in such a way that one doesn't know what type of behavior they can expect? Or is this just a practise that a developer should be comfortable with?

    • @zoran-horvat
      @zoran-horvat  ปีที่แล้ว

      This factory is returning the interface in order to make the object structure opaque to the caller.
      The factory itself could also be a separate object, leaving the subject class half-done, but with a strict rule that no external code should be allowed to call its constructor directly. Such a design would be valid if, for example, there is the requirement to support serialization which depends on direct use of class constructors. But then, you would have to be cautious not to break the contract, and to ensure that all custom code is strictly using the factory.

  • @driden1987
    @driden1987 ปีที่แล้ว

    Are you still guarding yourself from a single discount that is larger than 100% now ?

    • @zoran-horvat
      @zoran-horvat  ปีที่แล้ว +1

      Yes, because that single discount is always wrapped into a capping discount. The inner object itself does not guard, but you will never use the inner object directly.

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

      @@zoran-horvat Thanks for the reply. I also think the examples you give are great and definitely need a bigger audience.
      There are many great lessons in these vids