Design Patterns: Decorator

  Рет қаралды 25,761

Microsoft Visual Studio

Microsoft Visual Studio

Күн бұрын

This is the last of an eight part series where Robert is joined by Phil Japikse to discuss design patterns. A design pattern is a best practice you can use in your code to solve a common problem. In this episode, Phil demonstrates the Decorator pattern. This pattern allows behavior to be added to an individual object, either statically or dynamically, without affecting the behavior of other objects from the same class.
Resources:
- Sample code: github.com/skimedic/presentat...
- Design Patterns: Elements of Reusable Object-Oriented Software book: www.amazon.com/Design-Pattern...
- Head First Design Patterns book: www.amazon.com/Head-First-Des...

Пікірлер: 29
@fwd79
@fwd79 5 жыл бұрын
Full list for this series: 0. SOLID Design Patterns (start from here): kzfaq.info/get/bejne/l82biryBusmwoJs.html 1. Design Patterns: Command/Memento: kzfaq.info/get/bejne/sLiSe891ytXSY3k.html 2. Design Patterns: Strategy: kzfaq.info/get/bejne/h8B5qc-f3peznp8.html 3. Design Patterns: Template Method: kzfaq.info/get/bejne/g8xxqdZh05_Zfac.html 4. Design Patterns: Observer and Publish-Subscribe: kzfaq.info/get/bejne/bZiSl8R10ZqvfIE.html 5. Design Patterns: Singleton: kzfaq.info/get/bejne/qch9f5apq662kn0.html 6. Design Patterns: Factories: kzfaq.info/get/bejne/gKubaqWQrLupopc.html 7. Design Patterns: Adapter and Façade: kzfaq.info/get/bejne/jr-RY9Wet7O-YYU.html 8. Design Patterns: Decorator: kzfaq.info/get/bejne/bLaAgLVhrL3WioU.html
@bhagpreetbrar1782
@bhagpreetbrar1782 5 жыл бұрын
Thank you for the simple explanation on the decorator pattern :) that was very helpful
@sangramghorpade9021
@sangramghorpade9021 6 жыл бұрын
Very very nice design patterns series ... Very nice real life examples and explanation by Philip .. thanks for posting such informative vedio .. plz post more designs patterns vedio
@attilajakab4915
@attilajakab4915 3 жыл бұрын
Hi, nice explanation, thanks for sharing this. In the next videos it would be great to also have an example how the client would use this.
@bohdan-belei
@bohdan-belei 9 ай бұрын
Clear and excellent explanation. Thanks!
@joshualord986
@joshualord986 3 жыл бұрын
Fantastic video. Thank you!
@sampsonorson
@sampsonorson 4 жыл бұрын
The cost for the ExpressoShotDecorator should be Cost = decorator.Cost + .55M;
@jaimeogrady7602
@jaimeogrady7602 5 жыл бұрын
Thanks, very well explained.
@TheViking2
@TheViking2 3 жыл бұрын
Phil is very precise with words even on a casual statement. Robert has a tough time . Haha I've seen Phil correct Roberts statements at least a dozen times. but this is just friendly corrections. :). Best videos in the internet for Design patterns. 👍😎
@coderider3022
@coderider3022 2 жыл бұрын
Yeh total clash but it works
@Saranwity
@Saranwity 3 жыл бұрын
Thank you, very clear.
@zubetto85
@zubetto85 5 жыл бұрын
In the example with espresso, it seems that we duplicate the Ingredients list each time we add a decorator (each decorator maintains its own list of ingredients which contains all previous strings plus a new one). Why we can't add to BaseCoffee class the List private field and public methods that allow us to add elements in and retrieve information from this list. In this manner it could be similar to the event system. In general, if I suppose that my object can be modified then I add the property which stores the list of applied modifiers and some method that iterates over this list to define a final state of the object.
@coderider3022
@coderider3022 2 жыл бұрын
I like these 2 doing videos.
@rohitgalgali5512
@rohitgalgali5512 6 жыл бұрын
It would be really helpful if you guys could make a video on Code to interface and unity framework(ioc) topics
@nikkokhresna7080
@nikkokhresna7080 6 жыл бұрын
Why almost all of the videos about decorator pattern talks about coffe shop..of course bcos the book uses coffe shop as the example
@AntonioValentini88
@AntonioValentini88 6 жыл бұрын
Hello! I've got one question. In the EspressoShotDecorator we stack up all the decorated coffe ingredients plus the espresso. But for the cost we just add .55 to our cost, without considering the decorated coffee cost. This way, the espresso shot is gonna cost 0+.55 I think.... Or am i missing anything? Nice Tutorial by the way! Cheers! Antonio
@heathenmonk1249
@heathenmonk1249 2 жыл бұрын
4 years late but whatever. The first instance of the coffee "BaseCoffee" has a price of 1.50, and when you decorate it with the espresso you add .55 to that, totaling 2.05. As far as I know you will always need an instance if ICoffee in order to create a espresso, so you can't just instanciate an espresso by itself.
@coderider3022
@coderider3022 2 жыл бұрын
Yes like he said it’s an onion and each layer is changing the previous value.
@DanielRodriguez-ds2qs
@DanielRodriguez-ds2qs 4 жыл бұрын
How is the coffe example a decorator example and not a composite?
@zss123456789
@zss123456789 4 жыл бұрын
I couldn't find the link to the design pattern playlist, could someone please link? Thank you! Edit: Found it kzfaq.info/sun/PLT2NrqLzZng3YMek58eVZVkBiW3NyVSef
@mohammeds6314
@mohammeds6314 2 жыл бұрын
thanks
@chrisbubbles9850
@chrisbubbles9850 7 жыл бұрын
nice info guy's but maybe next time get a maybe a diagram , or even some uml schematic .. just the code allone makes it hard to follow Judith Bishop did a nice book on the subject years ago "C# 3.0 Design Patterns" published by O'Reilly
@MuletTheGreat
@MuletTheGreat 3 жыл бұрын
Hard disagree. Everybody else puts up Visio slides labelled A and B, while these two have a CONVERSATION and talk with their hands. It's brilliant, and easy to follow, for me at least.
@s_rox5042
@s_rox5042 3 жыл бұрын
Subsystem for the particula functionality, in short
@ibrahimelkilani8508
@ibrahimelkilani8508 6 жыл бұрын
I didn't understand fully
@sc5shout
@sc5shout 2 жыл бұрын
Oh, ok, so the decorator pattern is something similar to the ECS
@TheAngelOfDeath01
@TheAngelOfDeath01 Жыл бұрын
Guys, that's gonna mount to an ungodly amount of classes... @_@ I'm getting dizzy.
@budoray
@budoray 7 жыл бұрын
Because everyone decorates an onion. Facepalm.
@kenichimori8533
@kenichimori8533 6 жыл бұрын
Console Visualizing Data Transmission Portorate Bypass Polar Design Pattern if 0 else 0 function 0/00 Point Position Power 0^0/00 Omega Clock Signature ‰ Com Theta.
Design Patterns: Adapter and Façade
22:29
Microsoft Visual Studio
Рет қаралды 17 М.
Design Patterns: Factories
25:26
Microsoft Visual Studio
Рет қаралды 54 М.
I CAN’T BELIEVE I LOST 😱
00:46
Topper Guild
Рет қаралды 120 МЛН
아이스크림으로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 57 МЛН
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 105 МЛН
What is the Decorator Pattern? (Software Design Patterns)
19:41
Be A Better Dev
Рет қаралды 25 М.
Design Patterns: Command/Memento
31:08
Microsoft Visual Studio
Рет қаралды 34 М.
How to use the Decorator Pattern (Card Game Example)
14:55
git-amend
Рет қаралды 7 М.
Decorator Pattern - DESIGN PATTERNS (C#/.NET)
14:51
SingletonSean
Рет қаралды 6 М.
Decorator Pattern - Design Patterns (ep 3)
54:35
Christopher Okhravi
Рет қаралды 477 М.
Observer Pattern - Design Patterns (ep 2)
49:47
Christopher Okhravi
Рет қаралды 558 М.
Design Patterns: Singleton
16:11
Microsoft Visual Studio
Рет қаралды 28 М.
Bridge Pattern - Design Patterns (ep 11)
52:04
Christopher Okhravi
Рет қаралды 144 М.
What is the Strategy Pattern? (Software Design Patterns)
13:18
Be A Better Dev
Рет қаралды 55 М.
تجربة أغرب توصيلة شحن ضد القطع تماما
0:56
صدام العزي
Рет қаралды 54 МЛН
Отдых для геймера? 😮‍💨 Hiper Engine B50
1:00
Собери ПК и Получи 10,000₽
1:00
build monsters
Рет қаралды 2,7 МЛН
Clicks чехол-клавиатура для iPhone ⌨️
0:59