Master the Power of Composite Pattern in Rich Domain Modeling

  Рет қаралды 10,871

Zoran Horvat

Zoran Horvat

Күн бұрын

Пікірлер: 21
@num1nex337
@num1nex337 Жыл бұрын
Honestly, thank you so much for making those type of videos, as someone who is relatively junior it is hard to find a content that would allow me to level up. Most of the stuffs out there are 50th variation of how to use mediator or create a validation filter, but your videos are golden, they touch real world problems and provide solutions that can be extrapolated to other scenarios aswell.
@michaelkoss
@michaelkoss Жыл бұрын
"This is a trick question; you should not like it" 🤣
@adiazwise
@adiazwise Жыл бұрын
Great content, Thanks, I'm motivated to follow you courses in Pluralsight on these topics.
@saifeddinebenromdhane7553
@saifeddinebenromdhane7553 Жыл бұрын
Just wanted to say Thank you, i really do appreciate the kind of content you make.
@zoran-horvat
@zoran-horvat Жыл бұрын
Thanks!
@SteveNgaiCheeWeng
@SteveNgaiCheeWeng Жыл бұрын
Hi Zoran, what is your thought on using Strategy Pattern for the above requirement?
@zoran-horvat
@zoran-horvat Жыл бұрын
How would you apply it?
@matthewjames1648
@matthewjames1648 Жыл бұрын
My take is that the main difference will always be: Strategy Pattern will have Type A choose from Types b-n and determine which strategy should be the strategy(ies) to use. Composite Pattern will have Type A compose or aggregate the results from Types b-n in some way. So I don't believe Strategy Pattern would be a suitable drop-in replacement here in Zoran's example, unless you really misuse the Strategy Pattern.
@ivandrofly
@ivandrofly Жыл бұрын
Thank you :D
@АлексейДемин-ъ5ж
@АлексейДемин-ъ5ж Жыл бұрын
tnx for the video
@ghevisartor6242
@ghevisartor6242 Жыл бұрын
Amazing video, this is so helpful as a junior. One question: 2:05 At line 35,36,37 you register some formatters, did you make a video on those too? I see you register them with the interfaces, is it just in case you have to swap the implementation or is there more going on?
@zoran-horvat
@zoran-horvat Жыл бұрын
All those formatters implement the same interface, and so does the composite. That is the primary enabler for the Composite pattern.
@hemant-sathe
@hemant-sathe Жыл бұрын
Excellent video. In business, the discounts or rules for discounts are configured by business people and we don't want any code change or we have a multi tenant application and can't code for every customer. In such scenario the rules get implemented as some policy or a rule set and are stored in text file. Please consider showing a small example of how to convert this same discount rules to an external, say json/xml, file and load at the start.
@zoran-horvat
@zoran-horvat Жыл бұрын
I don't plan such a video now. I hope it was clear from the video that the object graph should be created by some object dynamically, rather than statically as I did in the demo.
@marvinxulu7816
@marvinxulu7816 Ай бұрын
why not use the factory pattern ?
@zoran-horvat
@zoran-horvat Ай бұрын
@@marvinxulu7816 How would that solve the problem?
@marvinxulu7816
@marvinxulu7816 Ай бұрын
@@zoran-horvat just asking as a junior these design patterns are new to me.
@krajekdev
@krajekdev 17 күн бұрын
@@marvinxulu7816 Factory pattern solves different problem than the one presented in the video. However, you are right, that within whole functionality a factory pattern could be used, for example, to instantiate some discount objects based on provided application configuration. In other words, factory pattern in a "creational" pattern, whereas composite i a structural pattern.
@ghostnguyen
@ghostnguyen Жыл бұрын
Hi Zoran, I think there is a better implementation that using 'true' Composite pattern. Your code still gets machine states which would be source of bug. Do you have repo url so I can create pull request?
@zoran-horvat
@zoran-horvat Жыл бұрын
There is no repo for this demo. What do you mean by sources of bugs, and what is your suggestion on how to fix that?
@ghostnguyen
@ghostnguyen Жыл бұрын
@@zoran-horvat Method GetDiscountAmounts in ChainedDiscounts should and could be improved. It has state, nested loops, two if statements and also middle return statement. Suggestion: ChainedDiscounts should be a chain of discounts, not a list of discounts. More suggestion. Then you don't need a ChainedDiscounts.
This Is the Place for LINQ in Modern .NET Design
5:55
Zoran Horvat
Рет қаралды 9 М.
Worst flight ever
00:55
Adam W
Рет қаралды 29 МЛН
ОТОМСТИЛ МАМЕ ЗА ЧИПСЫ🤯#shorts
00:44
INNA SERG
Рет қаралды 4,8 МЛН
Bike Vs Tricycle Fast Challenge
00:43
Russo
Рет қаралды 103 МЛН
Wish To Remove Primitive Obsession? Try This Effective Technique!
15:28
Use Null Object Pattern in Your Rich Domain Model
13:16
Zoran Horvat
Рет қаралды 11 М.
Main Hall 06: Why is Functional Programming so hard?
37:44
DDD Melbourne
Рет қаралды 3,5 М.
Combine Design Patterns To Reveal Their Greatest Power
14:21
Zoran Horvat
Рет қаралды 7 М.
This Decorator Pattern Implementation Will Make Your Day!
9:37
Zoran Horvat
Рет қаралды 10 М.
Worst flight ever
00:55
Adam W
Рет қаралды 29 МЛН