Design Patterns: Decorator

preview_player
Показать описание
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:

Рекомендации по теме
Комментарии
Автор

The cost for the ExpressoShotDecorator should be Cost = decorator.Cost + .55M;

sampsonorson
Автор

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.

attilajakab
Автор

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. 👍😎

TheViking
Автор

Why almost all of the videos about decorator pattern talks about coffe shop..of course bcos the book uses coffe shop as the example

nikkokhresna
Автор

Clear and excellent explanation. Thanks!

bohdan-belei
Автор

Thank you for the simple explanation on the decorator pattern :) that was very helpful

bhagpreetbrar
Автор

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

sangramghorpade
Автор

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<ICoffee> 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.

zubetto
Автор

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

AntonioValentini
Автор

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

chrisbubbles
Автор

It would be really helpful if you guys could make a video on Code to interface and unity framework(ioc) topics

rohitgalgali
Автор

How is the coffe example a decorator example and not a composite?

DanielRodriguez-dsqs
Автор

I couldn't find the link to the design pattern playlist, could someone please link? Thank you!

zss
Автор

Subsystem for the particula functionality, in short

s_rox
Автор

Guys, that's gonna mount to an ungodly amount of classes... @_@ I'm getting dizzy.

TheAngelOfDeath
Автор

Oh, ok, so the decorator pattern is something similar to the ECS

scshout
Автор

Because everyone decorates an onion. Facepalm.

budoray
Автор

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.

kenichimori