No video

Decorator Pattern - Design Patterns (ep 3)

  Рет қаралды 480,687

Christopher Okhravi

Christopher Okhravi

Күн бұрын

Video series on Design Patterns for Object Oriented Languages. This time we look at Decorator Pattern.
💙 BUY MY BOOK:
leanpub.com/th...
► The playlist
• Design Patterns in Obj...
► Head First: Design Patterns
geni.us/nlbA6
► Design Patterns: Elements of Reusable Object-Oriented Software
geni.us/PsXmo
💪 Patreon Community
/ christopherokhravi
📚 Products I Recommend
geni.us/71ZXF

Пікірлер: 851
@bot-bot
@bot-bot 7 жыл бұрын
Hey Christopher, when you mention you use the Decorator pattern when trying to deprecate the usage of some class, wouldn't an Adapter/Facade pattern be better for that? I'm new to design patterns so I'm just trying to analyze it a bit :) BTW, when is the next pattern coming out?
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Excellent question! While filming, this question struck me as well. It's really quite hairy. They are deviously similar and I keep forgetting the nuances :) TLDR; I agree with you. But, let's define the concepts... 1) The adapter adapter pattern changes the interface but does not change the implementation. 2) The proxy pattern changes the implementation but does not change the interface. 3) The decorator pattern changes the implementation but does not change the interface. 4) The facade pattern is a high-level level abstraction over low-level components, where the interface is changed. So, I guess it boils down to proxy vs decorator. The deprecation example I gave could, depending on the scenario, probably be technically considered decorator pattern. But then again, it's a too simplistic example that doesn't really take advantage of the true power of decorator pattern. So I agree with your comment. Further, my example becomes even more silly if we look at it in a statically typed language (I usually work in dynamically typed languages and was thinking of that when I blurted out the example). In the decorator pattern we have the two interfaces Component and Decorator. The old class we want to deprecate is a Component, but if we were to use Decorator Pattern to deprecate it then the new concrete class would have to be a Decorator which in turn is a Component. From an abstraction point of view, this is actually a good thing because the abstract Decorator could then make sure to delegate all method calls to the decorated Component, which leaves the concrete Decorator with the job of only implementing the few methods it wants to change. But then again... this is probably massive overkill, and you'd be better off just throwing in a proxy where the proxied object is dependency injected into the proxy. Interesting excursion :) Thank you for the comment. I need to think my examples through a bit better before rocking it :) Ps. I've got an older video on Adapter vs Facade vs Proxy here: kzfaq.info/get/bejne/nrpzZtWet6itqKc.html
@bot-bot
@bot-bot 7 жыл бұрын
Thank you for a very detailed and educational answer :) I still haven't touched the Proxy pattern which I'll do next and that is probably the reason why Adapter and Facade were the first that came to mind. For now it makes sense why and how to use the Decorator for deprecation even if it is an overkill. It's good to have these examples in your videos because they give us the opportunity to think about them and ask when unclear, so keep it up, it's all good :) I enjoy the Code Walks as well, especially liked the one about VR/AR and moving coding away from the monitor+keyboard environment!
@theesunnlightt2268
@theesunnlightt2268 7 жыл бұрын
Christopher Okhravi, Thank you very much for these amazing videos.
@shanmugamsekar4044
@shanmugamsekar4044 6 жыл бұрын
In this case , i think proxy pattern makes sense. Awesome video Chris .
@borjagomez1663
@borjagomez1663 6 жыл бұрын
BEST saxo ever
@serkangoktancelik5081
@serkangoktancelik5081 9 ай бұрын
This man's explanation is so much better than any prof I have in uni and all other KZfaqrs. Thank you.
@jean_luc_retard
@jean_luc_retard 7 жыл бұрын
dude, I haven't even noticed when almost an hour passed. I was never this interested and focused on a video before. Good job. Excellent teaching flow.
@sshanzel
@sshanzel 4 жыл бұрын
This is true. I have never been patient enough to watch a vid for a whole hour and still wanting to watch the next one
@tanveerhasan2382
@tanveerhasan2382 2 жыл бұрын
@@sshanzel i concur
@alnm951
@alnm951 Жыл бұрын
Same for me!
@rizvinazish
@rizvinazish 7 жыл бұрын
One of the best explanation in KZfaq pattern videos, classic!
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
One of the best comments on KZfaq :) :) ;)
@smilerelax5265
@smilerelax5265 5 жыл бұрын
execuse me this is the best not one of the best. believe me i went trought them all.
@harshtalwar9615
@harshtalwar9615 4 жыл бұрын
@@ChristopherOkhravi (One of the best comm......) 😁 yes, it is true.
@sshanzel
@sshanzel 4 жыл бұрын
Not one of the best. But actually THE BEST OF EM ALL
@FlipYourLearning
@FlipYourLearning 2 жыл бұрын
This series is becoming one of my favorite coding tutorial series here on KZfaq, as a combination of the delivery and the value. Every video keeps me engaged from beginning to end, and each has all I need to start applying the concept to my own projects. Thanks for making them.
@Anonymous-vd1pb
@Anonymous-vd1pb Жыл бұрын
noob
@fordsim7
@fordsim7 5 жыл бұрын
I love how the cat wanted to learn about the Decorator pattern at the end. Love the videos by the way
@kareemjeiroudi1964
@kareemjeiroudi1964 4 жыл бұрын
You asked us in the video if you should change anything. Please don't change anything. Your videos are goddamn awesome! Just keep making more videos. The community needs people like you who have the knack to explain things the way you do. Man, you are 100 times more valuable than all my university professors put together. World's best CS instructor!
@8uddishh
@8uddishh 6 жыл бұрын
I cleared three interviews back to back ... coz of this man... keep it up...
@shanm4629
@shanm4629 3 жыл бұрын
More than KZfaq supporting you, its actually you are helping youtube to provide such a quality content to public. Thanks for sharing this.
@406owner
@406owner 7 жыл бұрын
by far, you are the best. your teaching and explaining methods are simple and easy ( and in the world of programming, that is priceless ) waiting for the next episode.
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Osama Tamimi Thanks for taking the time to write this comment. I appreciate it. I'm glad the video is useful :)
@ryancederoth727
@ryancederoth727 4 жыл бұрын
@2:38 Wow... I spent, like, 3 days a couple months ago researching Abstract classes and didn't manage to gain, like, a lick of insight. This guy sums it in a TOTALLY understandable way in all of a minute.. and this tutorial isn't even about abstract classes!!
@Brunoenribeiro
@Brunoenribeiro 3 жыл бұрын
Love how "coffee" starts to lose its meaning and becomes just a data thing during this video 😂 just kidding. Love your content, the best I found in yt
@abdulquadiransari7476
@abdulquadiransari7476 Жыл бұрын
The best part of this video series that Christopher Okhravi is teaching from a book. At first these vidio series were not making any sense to me. But after I read the chapter from the book and came back to this video I understood the concept even better. Thanks Christopher for making videos on KZfaq. I wonder where have you gone since 6 years now !!!!
@nikteaeon4952
@nikteaeon4952 7 жыл бұрын
:D 52:14 Wild cat appears! Your vids are great, I'm watching them after read the chapters of the book, it's a good book but thanks to you the concepts are retained and assimilated better, while reading the Beverage example I was thinking too maybe it was not the best way of coding that program, now you have made clear the reason 8) thanks xD besides it keeps me awake when you cut your movements in the vid lol it would be funny if teachers could do this in class
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
+10 bonus points for noticing the wild cat! :) :) Thanks for your comments. And indeed it's quite a benefit to be able to cut your presentation. Much harder for teachers in class, agreed :) :)
@manohars811
@manohars811 7 жыл бұрын
Hey, how are you? i like your funny things and funny face you make at the beginning of your videos. And you are good teacher.
@dodostreetball
@dodostreetball 6 жыл бұрын
Nikte Aeon i
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Next ep is slightly delayed due to crunch time at work. But I'll get it up asap.
@AbdAllahBoda
@AbdAllahBoda 7 жыл бұрын
waiting :)
@vsinha
@vsinha 7 жыл бұрын
waiting :)
@shahzeb5130
@shahzeb5130 7 жыл бұрын
waiting christopher...
@adkadatka244
@adkadatka244 7 жыл бұрын
Hey man, you're amazing at explaining, but I have a question - would strategy pattern also be appropriate for this scenario(The coffee shop)?
@ebut0oy
@ebut0oy 6 жыл бұрын
Can you explain the visitor pattern too please? Christopher
@Venezuelangel
@Venezuelangel 4 жыл бұрын
HOOOOlLLLLLYYYY CRAP, I was recommended your videos by the YT Algorithm and I was like, "nah, I'm just a Junior Dev, I ain't gonna need Design Patterns for another year"... WRONG! So glad the algorithm found you again. Subscribed.
@88ylli
@88ylli 2 жыл бұрын
It's funny because before watching your videos I was getting information about patterns on different sources, and it seemed to me that all different sources were saying different things on the same pattern. Then after watching your videos I realized that all these sources were saying the same thing. Definitely the simplest explanation ever. Thank you!
@chrishopkins652
@chrishopkins652 4 жыл бұрын
I absolutely love these explanations. Thanks so much for them. I found it confusing to think of Caramel/Chocolate as types of beverages. It helped me to think of the Abstract Beverage class as a 'Product' instead. Both Espresso and Caramel are Products that the coffee shop sells, but Espresso is the base Product. Caramel is an addon but also still a Product.
@Gobberfisch
@Gobberfisch 6 жыл бұрын
the way you are teaching is genius, I watch one video and get it all, no need to look anything up afterwards
@pcccmn
@pcccmn 4 жыл бұрын
Came here after reading and leaving Head First's Decorator chapter confused. This video makes everything super clear! Thank you.
@rob876
@rob876 5 ай бұрын
I've never heard a better explanation of the decorator design pattern. Thank you.
@panosgr7228
@panosgr7228 4 жыл бұрын
When reading the book I kept on asking myself why we were calling the toppings (Soy, Mocha, Whip, etc) beverages and even using an "IS-A" relationship when they clearly aren't beverages lol. So those two key pieces of information at the end really helped me understand this pattern. 1. You should look for alternatives if the Decorators you are using aren't actually of the type of component which you are initially wrapping. 2. You shouldn't use Decorator Pattern when the only variation between Decorators is a couple of properties. I feel like watching your explanations really complements the information in the book and will continue to watch the rest of the series. Thanks for this!
@heraldo623
@heraldo623 4 жыл бұрын
51 min to explain decorator, I never seen so long explanation of a pattern. That's excellent
@yussufclark9390
@yussufclark9390 6 жыл бұрын
This is really good stuff. Please don't stop making these videos, unless you've already exhausted all the information of course. You're a really good teacher and you're easy to follow.
@JeremyMoritz1
@JeremyMoritz1 3 жыл бұрын
Outstanding! Thank you so much for all of the quick cuts throughout the video. This shows great respect for your audience's time and makes the content much more interesting, digestible, and entertaining!
@thunderkiss007
@thunderkiss007 7 жыл бұрын
Explained very well and please continue for all Design patterns which are explained in book.
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Fikret thanks! Will do :)
@msaifii
@msaifii 6 жыл бұрын
I do not have patience to watch long explanation. But I confess that I watched the first three videos in one seat with out getting bored. Congratulation for the excellent explanation!
@kserra9112
@kserra9112 3 жыл бұрын
Still the best video ever about explaining the decorator pattern.
@yairshahar1560
@yairshahar1560 7 жыл бұрын
hey Christopher, great explanation. You have unique way for explain complicated things to be easy understand, thank you very much ! I am looking forward for the next chapters...
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Thank you for the kind words. And thanks for watching.
@apurvapachgade9305
@apurvapachgade9305 4 жыл бұрын
You know the person is good teacher when you understand what they convey even at a 2x speed .. :'D
@doken2000
@doken2000 7 жыл бұрын
This man is the Carl Sagan of programming, with all due respect for both of them of course
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
+Oswaldo Oquendo Castro Haha :) Thank you sir. Didn't know who he was but youtubing some clips of him and he seems like a fairly charismatic dude so thank you :)
@doken2000
@doken2000 7 жыл бұрын
That's exactly the word Christopher "charismatic"
@iamdijki
@iamdijki 2 жыл бұрын
Wow.. I didn't sleep in a long lecture? what a miracle!
@dcngn_
@dcngn_ 3 жыл бұрын
After listening to 1 hour of how not to implement the coffee shop system I was really wondering what would be the most efficient way instead? Anyway, this video really cleared my mind regarding the decorator pattern, so mission accomplished!
@BooSgu
@BooSgu 2 жыл бұрын
I love your method of teaching. Ez than reading than the books.
@MahmoudRKeshk
@MahmoudRKeshk 6 ай бұрын
That was awesome! A detailed neat explanation ... Now I got how the linq operators work under the hood ! This pattern with method chaining in C# will be absolutely great. Thank you !
@miracledoh4020
@miracledoh4020 4 жыл бұрын
For those who are looking for the difference of using a decorator and a List, go to 46:30, Christopher talked how the classical example of beverage, or pizza is unsuitable for the decorator pattern and scenarios that make it suitable.
@DBakars
@DBakars 7 жыл бұрын
Hi Christopher, I by mistake came across your channel and am wonderstruck with your style of telling the things. I already had the book but everything never meant much sense until I started watching your videos.Thanks for making things simple. Eagerly waiting for your next videos. Please keep us posted. :)
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Thank you for the kind words :) :)
@XxxGuitarMadnessxxX
@XxxGuitarMadnessxxX 3 жыл бұрын
I'm EXTREMELY happy that I recently found your channel. Been watching your design patterns playlist in order and I've been actually getting pretty excited about implementing them in my code! So far, I've found the talks about Observer and this one about decorators to be suuupperr helpful with a thread-safe logging library I'm making for use in other personal projects where the observer pattern is used in managing multiple loggers and progress indication bars and this decorator pattern is used in the logger sinks and progress bar attributes. Again, Thank You for making easy-to-digest videos as they have been super helpful in grasping new concepts so far!
@puneetsingh6782
@puneetsingh6782 2 жыл бұрын
Hey Christopher, thank you! your prodigious energy, and no-beating-the-bushes style of teaching is awesome. You convey your ideas very clearly, and succinctly
@92MarckO
@92MarckO 7 жыл бұрын
Great video, please do not stop making these!
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
92MarckO Thanks! No worries. I won't.
@kabir85m
@kabir85m 7 жыл бұрын
Waiting for next videos..... please......
@OmarChida
@OmarChida 4 жыл бұрын
I don't usually comment on videos. But this time I have to. Because you completely nailed it man best explanation ever heard! Before I used to think that I understand DP. But after watching your video I relalised that I actually don't.
@msh6783
@msh6783 2 жыл бұрын
best explanation on youtube by far
@keaman
@keaman 7 жыл бұрын
Great description! Read that book about 10 years ago but never understood the pattern as much as I do now having seen your video.
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
That's awesome! I'm glad to hear the videos complement the contents of the book. Thank you very much for sharing and for watching :)
@sameer1234ification
@sameer1234ification 3 жыл бұрын
I don't feel of time when watching this series ... Great explanation
@roman_mf
@roman_mf 2 жыл бұрын
I've just started to dip my toes into design patterns and boy am I glad I found this video. Excellent explanation. Heard about the book but now I'm more motivated to start reading it. I'm sure it will go super well together with your videos. Thank you!
@kareemjeiroudi1964
@kareemjeiroudi1964 4 жыл бұрын
I would also argue that for this Coffee example, the decorator pattern is an overkill. I think the suggested solution at 48:30 is a more suitable one. I just wanna say thank you a ton for your hard work. Please keep making more videos 👍.
@sushmitagoswami7320
@sushmitagoswami7320 2 жыл бұрын
A huge respect and admiration to you for sharing your knowledge in such a lucid way. I would request if you can also include some real life use cases at end of each pattern, it would help us tremendously.
@shaanmohammed33
@shaanmohammed33 4 жыл бұрын
Awesome explanation (Special applause for telling how decorative pattern is more useful in cases of behavioural changes rather than value changes which is a better scenario for using iterator patter). If someone has not gone through iterator pattern, just by that line of yours he/she will get to know everything about the iterator pattern. Great Teacher you are. Keep on doing the good job of educating others.
@imsoanju
@imsoanju 5 жыл бұрын
I absolutely love listening to you. Not only you explain everything in a great and understandable way but you also have such an awesome vibe going on. Love it.
@parhamzolfaghari7394
@parhamzolfaghari7394 8 ай бұрын
mid-way through the video, but had to tell you you're teaching is top-notch!
@piegoesboom
@piegoesboom 3 жыл бұрын
I wish more college professors could explain topics this well and with this much enthusiasm
@mikeysplayhouse1971
@mikeysplayhouse1971 3 жыл бұрын
You actually know your shizzle shazzle shoozle. Five out of five. I love it.
@aldolunabueno2634
@aldolunabueno2634 4 ай бұрын
4:21 Discussing the definition of decorator pattern 19:02 How to apply the decorator pattern to the example. 31:47 Generalized UML diagram. 46:31 Why I think this example is not suitable for the decorator pattern. 52:40 Last thing about the example: how to use it.
@kemrank8739
@kemrank8739 2 жыл бұрын
This decorator pattern completely reminds me Nolan's films. I do believe that, Christopher Nolan uses design patterns in his scenarios :) By the way, thank you a lot for a best explanation ever !
@unofficialshubham9026
@unofficialshubham9026 6 ай бұрын
relating it to recursion is 🔥
@ettiennebotes7832
@ettiennebotes7832 2 жыл бұрын
This guy actually explains the work in an understandable manner, if he was my professor, then maybe the other half of students would still be there.
@Anonymous-vd1pb
@Anonymous-vd1pb Жыл бұрын
noob
@RajVadla
@RajVadla 3 жыл бұрын
You are a savior. Thanks for your time and care about community 💐
@bernong1
@bernong1 3 жыл бұрын
This the the This video I have watched. This is amazing. Clear, concise, hits home on all the points to clarify the design and how it is implemented. I have not been able to get this clarify for years by reading books. Past 2 days of watching your videos was time well spent.
@typsy1981
@typsy1981 6 жыл бұрын
You really feel and understand very clear what you are saying about. Good job Chris! Great explanation!
@nemanjastankovic941
@nemanjastankovic941 5 жыл бұрын
Very very very good explanation. I'm impressed. It is obvious that you're getting better with every video. Video is a little bit long, but you've managed to keep my attention. Great job. Regards from Serbia.
@firuzafynchina9208
@firuzafynchina9208 Жыл бұрын
What a cool tutorial. thanks for a comprehensive tutorial and charisma. 50 mins passed so fast!
@ridakalim6218
@ridakalim6218 Жыл бұрын
just watched this and my mind is blown u explained it so well its so simple
@neolopus
@neolopus 3 жыл бұрын
Best explanation about Decorator. after 5 videos, it finally makes sense.
@jawharomeryaba8696
@jawharomeryaba8696 6 жыл бұрын
I love the way this guy is moving
@MikhailDangcal
@MikhailDangcal 6 жыл бұрын
i like the explanation. programmers who are doing Point of sale System can totally understand your explaination.
@rickmonarch4552
@rickmonarch4552 4 жыл бұрын
Ur way better than my old uni teacher.
@renarsdilevka6573
@renarsdilevka6573 4 жыл бұрын
From refactoring.guru "Decorator and Proxy have similar structures, but very different intents. Both patterns are built on the composition principle, where one object is supposed to delegate some of the work to another. The difference is that a Proxy usually manages the life cycle of its service object on its own, whereas the composition of Decorators is always controlled by the client."
@callmeartae
@callmeartae 6 жыл бұрын
Awesome job, as always! Just one teeny tiny point - in teaching, repetition is good. It's more than good - it's crucial. I can't stress enough how crucial it is. But keep in mind that repetition of a concept does not necessarily mean explaining it multiple times. Explain it thoroughly once or twice and then repeat, repeat, repeat but only the gist of the concept or even just the name of it. I'm talking about the HAS-A/IS-A part in your video - it's sufficient to explain it once or twice and then to remind your audience: "remember: IS-A/HAS-A" so they immediately think about "decorator pattern" when they hear "IS-A/HAS-A" or vice versa. Just a quick tip from a methodological point of view, I hope you don't mind my babbling. Anyway thanks for the video, can't wait to see more!
@mrkhan7599
@mrkhan7599 4 ай бұрын
Atlast! Some simple way to explain decorators!
@SwethaSaseendran
@SwethaSaseendran 3 жыл бұрын
I would recommend this channel to all my collages who wants to learn about design patterns. You are doing an amazing job Christopher. Thanks a lot. :D
@ayushbaunthiyal5822
@ayushbaunthiyal5822 Жыл бұрын
The last two minutes where Chris went crazy on Push Pull, Push Poll, Push Pull, Pol, Pooling. God!🐵
@dynamic_pointer_cast
@dynamic_pointer_cast 3 жыл бұрын
Indeed, the Coffee/Condiments example is quite roundabout since we can just represent a combinations of condiments as a string (each character represents a condiment) and have this string analyzed to get the final cost. This is even more flexible since we can manage rare situations where we want certain combinations produce an entirely different cost (or even Description).
@TheMinino123
@TheMinino123 7 жыл бұрын
Even the cat is interested in your explanation. Great work! Please keep doing this. I'm reading the book too, and this is making my learning really keep in my mind. Thank you a lot ^_^
@Serg13975
@Serg13975 4 жыл бұрын
This channel is exactly what I needed. Thank you for existing. You are doing a golden job!
@jareeq
@jareeq 4 жыл бұрын
Christopher, your explanations are among the best , multi level references, kept my mind focused and thanks of that i can simply remember more. Thank you.
@jonp9511
@jonp9511 7 жыл бұрын
Christopher, thank you so much. I finally came across your channel today when searching for info on the decorator design pattern(liked and subscribed). It is exactly what I have been looking for. I go to school online and sadly there is little to no actual "face-to-face" instruction. By that I mean, we have assignments, and are essentially left to own to figure out how to work through them. In fact the class I am taking now does not even have an accompanying textbook. I don't learn well by relying on slow email correspondence ( I am a busy man) to drive some complex principles home. Sometimes I need to have things broken down into very simple terms and viewed from several different angles to finally sink in, so that I can actually use it in practice and not just theory. Your approach here is exactly what the Dr ordered. Again, thank you very much.
@SunggukLim
@SunggukLim 7 жыл бұрын
Now I fully understood Decorator pattern. thanks!
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
+Sungguk Lim Nice! I'm glad :) Thanks for watching.
@tubairoy8493
@tubairoy8493 6 жыл бұрын
In he beverage example , if we want to add multiple decorators , then each time the price of expresso will be added too. But we need to add only the decorator prices after the first decorator(because first time the expresso price will be added already). The ArrayList method will be more suitable for this example
@darkojakimovski3834
@darkojakimovski3834 5 жыл бұрын
I'm 8 minutes in and I must say I love your voice AND your man bun brozeph! I'll edit this once I finish watching. Edited: I wrote everything you said in an IDE and it doesn't work. Though I got a better understanding of the concept now, I'll just need to power through I guess. Nicely explained btw.
@joehsiao6224
@joehsiao6224 5 жыл бұрын
The intro is exactly why I am here. After going through the Decorator chapter, I immediately went to Google for another example.
@sergioshev
@sergioshev 6 жыл бұрын
Thank you for so nice work you are doing! Was a honor to view your teaching. Very useful.
@truefalser4555
@truefalser4555 6 жыл бұрын
Your presentations are so good, that there will be no more interview questions related to these patterns, since everyone knows them if watched your vids:)
@jvsnyc
@jvsnyc 2 жыл бұрын
Around ~8:00, in Java, at least, when you made this video, you can indeed have default instance method behavior in an interface, of course, I know this is considering various languages with examples in Java, but that is something that could be mentioned. I don't think you are monitoring this channel very closely, but this series is just racking up more and more views. Very good stuff.
@kopilkaiser8991
@kopilkaiser8991 10 ай бұрын
Thank you for taking the time on explaining the Decorator pattern. I've been introduced to it for the first time on this video and it is all thanks to you. I found this resource helpful and useful at the same time, you are very good in being able to illustrate all the different perspective to this subject.
@rosscarlson3701
@rosscarlson3701 3 жыл бұрын
Perhaps the coffee example could become more appropriate for the decorator pattern if you think about the possibility that each coffee add-on could change not only properties (cost) but also behavior by adding a make() method. Now, the way the coffee is made changes with each decoration. It doesn't change only the price.
@KartelCoke
@KartelCoke 5 жыл бұрын
52:13 Discussion over now hooman!
@JoeSmith69
@JoeSmith69 4 жыл бұрын
Came here to comment this.
@ChristianBale-gi7ez
@ChristianBale-gi7ez 6 күн бұрын
Such a cute cat!
@tutanchacon
@tutanchacon Жыл бұрын
One of the best explanations I've ever seen. You are a great teacher
@MohamedEmaish
@MohamedEmaish 7 жыл бұрын
It's first time to see you or know about you , but after only 5 minutes watching I feel that I need and should watch all your videos :)
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
+Mohamed Abou-Emish Awesome :) Feel absolutely free to do :) :) Thank you for the comment.
@billcui6317
@billcui6317 3 жыл бұрын
Dude you're amazing. Thanks man really helped me with my CS course
@Adi-mj3cb
@Adi-mj3cb 4 жыл бұрын
Your way of repeating things over and over again is absolutely brilliant, keep doing this. Well done. I thank you. Also, the very last part where you showed how to actually implement it - that is very important as well! I was wondering if that would show up at it thankfully did. Absolutely wonderful job all around.
@LEGOOOOOOOOOOOS
@LEGOOOOOOOOOOOS 2 жыл бұрын
On my 5th video with this dude. He is amazing. Dude needs to get back to it.
@Aslam2012ful
@Aslam2012ful 6 жыл бұрын
OMG, this is the very best abstract explanation ever....
@charlesvaradharaj4099
@charlesvaradharaj4099 6 жыл бұрын
The way you edit the videos keeps us concentrated. Like a Guy Ritchie movie :)
@AlexServirog
@AlexServirog 6 жыл бұрын
On the UML diagram (34:19) Decorator has a has-a arrow to Component, but in the code example (45:10) instance variable Baverage beverage; introduced in decorator implementation instead of abstract decorator. I guess "Beverage beverage;" line should be moved from a Caramel class to an AddonDecorator class.
@takssir
@takssir 6 жыл бұрын
Alex Servirog yup i agree with you
@takssir
@takssir 6 жыл бұрын
Hopefully he will answer your wondering
@danzaverdk
@danzaverdk 5 жыл бұрын
was this already answered?
@Daniel-dj7vc
@Daniel-dj7vc 5 жыл бұрын
I think this is because the code example was quite simplified and it did not include a getter method in the abstract class. IMO the abstract classes should be treated as Interfaces. It means You shouldn't declare the instance variabale beverage on the AddonDecorator class, instead You should introduce an abstract method "getBeverage()" there. It would force on you a declaration of beverage instance variable and an implementation of the getter on the concrete class, keeping the abstract class/interface clean.
@k.safonov
@k.safonov 3 жыл бұрын
You should take money for such lessons. You have teaching talent.
@EaZySaSo
@EaZySaSo 5 жыл бұрын
And here I thought I would never get Design Patterns! you are AWESOME!
@mireazma
@mireazma 3 жыл бұрын
You could get rid of the need for a base case by simply making the abstract class have an object of itself (be the decorator). This makes it possible: 1. In our case, have just caramel. 2. Doesn't enforce an order (anchor the decorator chain on decaf or espresso at the bottom).
@Stehocke
@Stehocke 4 жыл бұрын
Nice video. I am teaching programming and your whiteboard + cut seems to be the key. The pace is perfect. Usually i finish the class with a nice board picture provided in a confuse way or i just need to long to draw and write the illustrations.
@metehanmutlu9187
@metehanmutlu9187 3 жыл бұрын
Nice video! Nice explanation! Thanks. I think there is a slight difference between class diagram and pseudo code which might not matter much but i wanted to mention anyway. On the class diagram abstract decorator class has 'Has A' and 'Is a' relationship but on pseudo code doesn't have a Beverage property(so there is not a 'Has a' relationship), instead concrete decorator class(caramel or soy) has.
@sudhakark91
@sudhakark91 5 жыл бұрын
Never heard better explanation than this about design patterns.. you are awesome..
Factory Method Pattern - Design Patterns (ep 4)
27:21
Christopher Okhravi
Рет қаралды 542 М.
Observer Pattern - Design Patterns (ep 2)
49:47
Christopher Okhravi
Рет қаралды 561 М.
Zombie Boy Saved My Life 💚
00:29
Alan Chikin Chow
Рет қаралды 8 МЛН
ОБЯЗАТЕЛЬНО СОВЕРШАЙТЕ ДОБРО!❤❤❤
00:45
How principled coders outperform the competition
11:11
Coderized
Рет қаралды 1,6 МЛН
What is the Decorator Pattern? (Software Design Patterns)
19:41
Be A Better Dev
Рет қаралды 25 М.
Always Use Interfaces
8:08
Christopher Okhravi
Рет қаралды 46 М.
8 Design Patterns EVERY Developer Should Know
9:47
NeetCode
Рет қаралды 1 МЛН
When Microsoft Violated Liskov Substitution Principle in .NET
18:16
Christopher Okhravi
Рет қаралды 42 М.
Only Use Inheritance If You Want Both of These
9:10
Christopher Okhravi
Рет қаралды 16 М.
Design Patterns: Decorator
17:21
Microsoft Visual Studio
Рет қаралды 25 М.
Factory Design Pattern - Why and How with Code!!
15:35
Keerti Purswani
Рет қаралды 82 М.
Strategy Design Pattern
11:32
Derek Banas
Рет қаралды 748 М.
Zombie Boy Saved My Life 💚
00:29
Alan Chikin Chow
Рет қаралды 8 МЛН