Тёмный

Decorator Design Pattern 

Derek Banas
Подписаться 1,3 млн
Просмотров 422 тыс.
50% 1

Get the Cheat Sheet: goo.gl/MzW0g
Best Design Patterns Book : goo.gl/W0wyie
Welcome to my Decorator Design Pattern Tutorial. The Decorator allows you to modify an object dynamically. You would use it when you want the capabilities of inheritance with subclasses, but you need to add functionality at run time.
It is more flexible than inheritance. The Decorator Design Pattern simplifies code because you add functionality using many simple classes. Also, rather than rewrite old code you can extend it with new code and that is always good.

Опубликовано:

 

20 сен 2012

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 567   
@derekbanas
@derekbanas 5 лет назад
Learn in One Videos for Every Programming Language Subscribe to Bookmark them: bit.ly/2FWQZTx C++ : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Rub-JsjMhWY.html Python : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-N4mEzFDjqtA.html Java : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-n-xAqcBCws4.html PHP : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-7TF00hJI78Y.html MySQL : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-yPu6qV5byu4.html JavaScript : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-fju9ii8YsGs.html C# : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-lisiwUZJXqQ.html HTML5 : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-kDyJN7qQETA.html CSS3 : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-CUxH_rWSI1k.html JQuery : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-BWXggB-T1jQ.html TypeScript : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE--PR_XqW9JJU.html ECMAScript : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Jakoi0G8lBg.html Swift : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-dKaojOZ-az8.html R : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-s3FozVfd7q4.html Haskell : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-02_H3LjqMr8.html Handlebars : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-4HuAnM6b2d8.html Bootstrap : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-gqOEoUR5RHg.html Rust : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-U1EFgCNLDB8.html Matlab : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-NSSTkkKRabI.html Arduino : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-QO_Jlz1qpDw.html Crystal : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-DxFP-Wjqtsc.html Emacs : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Iagbv974GlQ.html Clojure : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-ciGyHkDuPAE.html Shell : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-hwrnmQumtPw.html Perl : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-WEghIXs8F6c.html Perl6 : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-l0zPwhgWTgM.html Elixir : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-pBNOavRoNL0.html D : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-rwZFTnf9bDU.html Fortran : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-__2UgFNYgf8.html LaTeX : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-VhmkLrOjLsw.html F# : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-c7eNDJN758U.html Kotlin : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-H_oGi8uuDpA.html Erlang : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-IEhwc2q1zG4.html Groovy : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-B98jc8hdu9g.html Scala : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-DzFt0YkZo8M.html Lua : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-iMacxZQMPXs.html Ruby : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Dji9ALCgfpM.html Go : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-CF9S4QZuV30.html Objective C : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-5esQqZIJ83g.html Prolog : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-SykxWpFwMGs.html LISP : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-ymSq4wHrqyU.html Express : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-xDCKcNBFsuI.html Jade : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-l5AXcXAP4r8.html Sass : ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-wz3kElLbEHE.html
@yuxiwan8917
@yuxiwan8917 6 лет назад
Move the "adding dough" to plain pizza class then the video is perfect!
@IronMeDen1
@IronMeDen1 2 года назад
10 years later and this video is still one of the easiest to follow and best videos on a design pattern I've seen so far! Thank you!
@derekbanas
@derekbanas 2 года назад
Thank you for taking the time to tell me you like them :)
@derekbanas
@derekbanas 11 лет назад
I'm happy they have been able to help you :) I decided a long time ago that I wanted to make long videos, but I also wanted them to be interesting and keep the viewers attention. I'm starting to really like the final results as of late. It has been very fulfilling to work at improving my teaching style. Thanks for giving the videos a look!
@RaiyanMonsur
@RaiyanMonsur 2 года назад
You've been a huge help!
@derekbanas
@derekbanas 11 лет назад
You're very welcome :) I'm doing my best to cover the more complicated topics in programming. I'm glad people are finding them useful
@derekbanas
@derekbanas 11 лет назад
Thank you :) I'm working from 6 different books to make this tutorial. I'll cover everything in the GOF book, but probably in completely different ways. I'm glad you are enjoying the tutorial
@derekbanas
@derekbanas 11 лет назад
Thank you for taking the time to tell me I was able to help :) That is very much appreciated!
@derekbanas
@derekbanas 11 лет назад
It is very nice to be able to clear up a subject when others haven't helped! Thank you :)
@derekbanas
@derekbanas 11 лет назад
You're very welcome :) Think of those classes that extend ToppingDecorator as if they are layering on functionality to the Pizza composite field in the ToppingDecorator object. So, first you create the Pizza object and then add additional functionality to getDescription and getCost using the toppings. Here is another tutorial on decorator that may help further newthinktank. com/2013/02/code-refactoring-16/
@derekbanas
@derekbanas 11 лет назад
Thank you for watching :) I'm glad to help
@derekbanas
@derekbanas 11 лет назад
I have all of the diagrams on my site. There is a link in the description for the video. I hope it helps
@derekbanas
@derekbanas 11 лет назад
You're very welcome :) Thank you for checking them out
@derekbanas
@derekbanas 11 лет назад
I'm just happy that you find it useful :) Thanks for the kind words. It is just a fun hobby of mine and I expect nothing in return
@derekbanas
@derekbanas 11 лет назад
Thank you :) I like covering niche topics that everyone else avoids
@derekbanas
@derekbanas 11 лет назад
Thank you :) I do my best to cover complicated topics in easy to understand ways. I'm glad you liked it
@sofiabravo9979
@sofiabravo9979 11 лет назад
I love this, thank you so much! It really helps to hear this concepts from someone rather that read boring books a thousand times for each pattern. It's really cool that you do this without expecting money or any type of retribution what so ever.
@derekbanas
@derekbanas 10 лет назад
You're very welcome :) Yes you could do what you described. It is really my fault because I didn't make an example that required the added flexibility this pattern provides. I tried to come up with a simple example of the pattern and in doing so I didn't get the best example. Sorry about that
@skkar2k2
@skkar2k2 5 лет назад
Bro, trust me, never find such great tutor where I can understand the design pattern so easily. You are the champ dude.
@derekbanas
@derekbanas 5 лет назад
Thank you for the nice compliment :)
@dantheman52420
@dantheman52420 8 лет назад
I read this pattern in Gang of Four today, was trying to figure out what the main method would end up looking like, very glad I found this video. None of my classes for my B.S. CompSci covered this stuff and I'm finding it very important for my job now.
@derekbanas
@derekbanas 8 лет назад
I'm very happy that I could help :)
@0x28
@0x28 7 лет назад
That is quite bizarre. Every B.S. in C.S. should cover at least 15 of the 23 patterns like in my degree. We had the GOF book and the companion book Design Patterns Explained, with an additional syllabus or 3.
@dantheman52420
@dantheman52420 7 лет назад
Congrats dude
@rohanofelvenpower5566
@rohanofelvenpower5566 5 лет назад
haha, MDX london here.2nd year we did Java. We didn't cover these. Just basic code and UML with related things like OOP thinking.
@derekbanas
@derekbanas 11 лет назад
I probably could have come up with a more specific optimized way to present this pattern. The ToppingDecorator could have been more simplified and then the ingredients could have done most anything. In videos I have to find an example that both demonstrates the pattern while keeping everything as simple as possible. Sometimes I get a great example and other times not so much. Sorry about that
@derekbanas
@derekbanas 11 лет назад
Thank you very much :) I love covering niche topics that others ignore
@derekbanas
@derekbanas 11 лет назад
You're very welcome :) Im glad you enjoyed it
@derekbanas
@derekbanas 11 лет назад
I'm confused by your question. ToppingDecorator provides those methods to the classes that extend it
@NZ255
@NZ255 8 лет назад
Man I'm hungry
@derekbanas
@derekbanas 8 лет назад
+NZ255 That's funny :)
@doaaahmed9730
@doaaahmed9730 2 года назад
That was a brilliant example demonstrating the decorator pattern . Thanks a million!
@derekbanas
@derekbanas 11 лет назад
You're very welcome :) I'm happy they are helping
@tautvydaskersulis7372
@tautvydaskersulis7372 3 года назад
Thanks, it's a great video explaining the concept very well. One thing that bothers me about commonly used patterns in Java is that they are often un-intuitive and do not reflect the real world as well as they could. I think the Decorator pattern is one of these. For example at 12:00 you have this line: ``` Pizza basicPizza = new TomatoSauce(new Mozzarella(new PlainPizza())); ``` I would intuitively interpret as making Mozzarella from PlainPizza and then making TomatoSauce from Mozzarella. The example below achieves the same results without decomposition and with a lot less boiler plate code, just by changing the mental model to something more intuitive and representative of real life. Are there any advantages to using the Decorator Pattern in situations like this? ``` List toppings = ArrayList(); toppings.add(new Topping("TomatoSauce", 0.35)); toppings.add(new Topping("Mozzarella", 0.5)); ToppedPizza ready = new ToppedPizza(new PlainPizza(), toppings); ``` I'm sure there are cases where Decorators are needed but I often see programmers using certain patterns to fit the solution into the their mental model when they should be reframing their mental model to match real life. What are your thoughts / experiences regarding this?
@MidasButSilver
@MidasButSilver 2 года назад
Late for a reply here, but in this case, yes, you are absolutely right. For such a simple example, a list would have done the job just fine. Its about always using the correct tool for the job and if the code was something more complicated you cannot simply rely on something like a list or array anymore. Say for example you are designing more complicated behaviour, for example enemies in a video game. Now each enemy could be different in some way: some are ranged fighters, others melee and the last group can do both, depending on the situation. You could change behaviour of each of them dynamically just with the corresponding decorator. Also in that situation a simple list just wouldn't quite do and probably fail miserably.
@jorgevasquezang
@jorgevasquezang 4 года назад
I am a Senior Developer, I watched these videos from Derek 6 years ago, and yes I am watching them again :) #lifeOfDeveloper
@derekbanas
@derekbanas 4 года назад
I'm very happy to hear that I continue to help :)
@stevenfox9695
@stevenfox9695 9 лет назад
Your videos are so great! I always recommend them to my friends taking the Software Design Pattern class at my university. Well done!
@derekbanas
@derekbanas 11 лет назад
Thank you :) I'm glad you enjoy them
@gandhihardikm
@gandhihardikm 9 лет назад
Thanks Derek for explaining decorator design pattern in such simple way... Hats off... cheers!!!
@derekbanas
@derekbanas 9 лет назад
Hardik Gandhi You're very welcome :) I'm glad I could help.
@rosasmellshaha
@rosasmellshaha 6 лет назад
You have saved my ass. Exam in one week and I was not getting any of this until I discovered your videos. Hero!!!
@derekbanas
@derekbanas 6 лет назад
Thank you :) Best of luck on your exams
@derekbanas
@derekbanas 10 лет назад
Thank you very much :) It is very nice of you to say that!
@derekbanas
@derekbanas 11 лет назад
Thank you :) I did my best and I'm glad you liked it
@derekbanas
@derekbanas 11 лет назад
Yes I slipped up a bit. Thanks for pointing that out
@laleen123
@laleen123 9 лет назад
Thank you so much for the excellent videos Derek, This is helping me a great deal in prepping for my CS exam! You are my hero!
@derekbanas
@derekbanas 11 лет назад
When I start thinking about using a design pattern I normally first ask if I can accomplish making the code more readable in some other way. If I can't think of another way I use the pattern. You'll find with experience that more often then not you'll use patterns rarely. The positives in knowing them are that you'll start to find other unique ways of solving problems while writing easier to understand code.
@robertgloverjr
@robertgloverjr 11 лет назад
Excellent. Thank you so much!!!!! I have read the Gang of Four book, but it is so long that the trees get lost in the forest. Your Decorator is so clear and logical. Bravo!
@derekbanas
@derekbanas 10 лет назад
That's funny :) Thank you for the compliment. I'm glad you are enjoying them.
@derekbanas
@derekbanas 10 лет назад
Thank you :) I'm very happy that I'm able to help.
@grandisukruth
@grandisukruth 11 лет назад
First of all thank you very much. This is the best design pattern tutorials i have ever seen. We demand some more stuff from you in future :).
@biman1988
@biman1988 11 лет назад
I always first see the running time of ur tutorials before playing. Then I feel like "ohh... so after 13 minutes the "future-me" would have learnt decorator pattern! Cool!!" Its better than counting the pages on a book n thinking "well... need to read 30 more pages to learn decorator pattern.. ahh forget it. will do later" I recently switched organization for almost double the salary (+ better work). And I owe u a big thanks since your videos were a very big help to me.
@jacklittle4226
@jacklittle4226 3 года назад
8 Years latter and still useful, thanks for the high quality video!
@derekbanas
@derekbanas 3 года назад
Thank you very much :)
@derekbanas
@derekbanas 11 лет назад
Thank you :) Im very happy that you enjoyed it
@ChaitanyaBhagwatChai
@ChaitanyaBhagwatChai 9 лет назад
Hey Derek, i'm just going to reaffirm what others have been saying on your videos all along: thank you so much for this incredible resource for learning about design patterns. Your videos are of such incredible help while studying, both because of your excellent explanations, as well as the nature of the medium (we can replay a segment we don't understand however many times we want) and the commented code that you provide. I am a big believer of a future for internet with micro-transactions, so i just went and donated you 5 bucks. It is not much, i am a student after all, but the content you provide warrants a gesture from me :)
@derekbanas
@derekbanas 9 лет назад
Chaitanya Bhagwat Showing your appreciation is more then enough for me. I'm very happy to be able to help like others have helped me in the past. Thank you for the compliment :) You're very welcome.
@derekbanas
@derekbanas 11 лет назад
Thank you :) it was fun to cover this topic
@alltheway99
@alltheway99 10 лет назад
are you sure you wanna have "Adding dough" in Mozarella class ? (10:00)
@budguesor9222
@budguesor9222 2 года назад
Rightly pointed out. It should be present in the constructor of the PlainPizza
@khana.713
@khana.713 5 лет назад
Hey man, i just gotta tell you that I love your videos and I love you. 3rd year of uni, and you still manage to help me through all the questions I have. Last semester you helped me out with Data Structures now you're helping me out with design patterns. Thank you once again, please keep this up!
@derekbanas
@derekbanas 5 лет назад
That is awesome to know :) I'm happy I have been of help
@html2664
@html2664 10 лет назад
Amazing! I'm from Ukraine, but your tutorial in English is easier than any of I could find in native language! Thanks!
@derekbanas
@derekbanas 10 лет назад
Thank you for the compliment :)
@vincent9563
@vincent9563 7 лет назад
Why don't you answer some questions on your comments?
@yukimushu
@yukimushu 11 лет назад
Fantastic tutorial, very well presented and easy to understand. Wish more tutorials were as high quality as this one! :)
@MojSoltani
@MojSoltani 10 лет назад
you're the master; never has anyone or any article or tutorial hit home design patterns to the point in such short and concise manner.
@derekbanas
@derekbanas 10 лет назад
Thank you :) I'm glad you enjoyed the videos.
@derekbanas
@derekbanas 11 лет назад
You can always override the PlainPizza class, add a topping of medium, large, Xtra large, etc. You could have all toppings have the same price and then just override the description. The rule extend what differs between toppings will steer you in the right direction
@derekbanas
@derekbanas 11 лет назад
Sure I will cover the top 23 patterns described by the GOF
@nishurangrej08
@nishurangrej08 11 лет назад
This is the best example to get the idea of decorator design pattern. Thanks Derek. :)
@derekbanas
@derekbanas 11 лет назад
Thank you :) God bless you as well
@LeBadman
@LeBadman 11 лет назад
You are a most excellent teacher. I usually have problems learning new (especially programming) concepts, but you made it very easy for me to understand. Your explanation is crystal clear. =)
@kaanapan1183
@kaanapan1183 3 года назад
Why? Why do you have a video about anything I look for? I love you bro.
@implutonium297
@implutonium297 4 года назад
Very Helpful tutorial, my first project in my Object Oriented Programming course just so happens to be creating a pizza ordering system where toppings are added using a decorator design pattern so this video was exactly what I needed! Thanks so much!
@derekbanas
@derekbanas 4 года назад
Happy I could help :)
@malcomclark2261
@malcomclark2261 9 лет назад
Headfirst design patterns explains things similarly but using drinks instead of pizza. You did a much better job of explaining it than the book did though.
@derekbanas
@derekbanas 9 лет назад
Malcom Clark Thank you for the compliment :)
@tonyweak3842
@tonyweak3842 8 лет назад
+Malcom Clark That's true! And HF DP is an excellent book for beginners, so this complement is even bigger. :-)
@nickzomchak9531
@nickzomchak9531 6 лет назад
Hey Derek, why don't u just use List instead and just loop through stuff. I think the pizza example, as well as drinks one are not suitable for this pattern, cause they do not add any new behaviour, u can't do new things with pizza. even if you decorated it. Please correct me if I'm wrong.
@Messier_-82
@Messier_-82 6 лет назад
You are right. This exact case is not suitable for Decorator Pattern. But this example shows well how the design works.
@enzopena1875
@enzopena1875 3 года назад
man thanks, a year trying to understand this pattern xD it was so easy
@Dayan2k7
@Dayan2k7 8 лет назад
Derek, your tutorials are the best! Highly respected!
@derekbanas
@derekbanas 8 лет назад
+Natnael “Dee” yonnatan Thank you very much :)
@nikhil2210
@nikhil2210 9 лет назад
Derek, You're the best man! The range of topics you have on your channel makes me wonder if there were a team of 4-5 different experts, but its just you, unbelievable. I would love to donate on your site once i have my paycheck. For this video, like others i do have some issues with code or the way it could've been done, but i understand the focus here is understanding the pattern and not the code that is written, Thumbs UP!!, You're awesome!
@derekbanas
@derekbanas 9 лет назад
Nikhil Laddha Thank you for the nice compliment :) There is no need to donate. I'm just happy that I can help.
@sealwithawkwardness3951
@sealwithawkwardness3951 5 лет назад
For those who don't know about SOLID principles, I recommend reading up on it. "Clean Architecture" by Robert Martin is a really good resource for this but you can just Wiki it. This design pattern is very powerful in that it directly tries to comply with the S(single responsibility) and O(open/close) of SOLID.
@derekbanas
@derekbanas 11 лет назад
Thank you :) I pay no attention to video count, views, or anything else. You guys seem to inform me on that stuff
@kacyraye
@kacyraye 10 лет назад
Thanks a lot for providing the code. Sometimes I don't quite get things through verbal explanations, but seeing you implement it and then thoroughly going through the code afterward really helped it click. Also, I think at the end of your tutorials that involve coding, you should do one final overview of what just happened when you run the program. In this video for example, I think you could've taken us through how the objects were being wrapped.
@vigneshsoap123
@vigneshsoap123 7 лет назад
Awesome. Much better explanation than HeadFirstDesignPatterns. Hats off.
@MrMalcovic
@MrMalcovic 6 лет назад
The UML association in the diagram is *composition*, not aggregation. Aggregation uses an empty diamond.
@carlmoller807
@carlmoller807 5 лет назад
Also, the Mozarella class extends ToppingDecorator. The ToppingDecorator does not extend Mozarella as the UML shows.
@jandeman8410
@jandeman8410 6 лет назад
I keep rewatching these series of design patterns in java. So far it helped me make my apps less violent and less complicated. Also, I love pizza! My thanks for your effort Derek. Kind Regards...
@derekbanas
@derekbanas 6 лет назад
I'm very happy to hear they helped :)
@derekbanas
@derekbanas 10 лет назад
You are very kind :) You're very welcome
@derekbanas
@derekbanas 10 лет назад
I took a short cut. You are correct that I should have defined a Dough class like I did with TomatoSauce. I was just being a bit lazy. Sorry about that
@bacanalienigena
@bacanalienigena 2 года назад
Thanks Derek just having this topic on my OOP Class.. and it helps a lot. Cheers mate.
@derekbanas
@derekbanas 2 года назад
Thank you very much :)
@babebebibobuuuuu
@babebebibobuuuuu 4 года назад
It's nearly 1 AM and I'm hungry because of you, thanks
@derekbanas
@derekbanas 4 года назад
That's funny :)
@babebebibobuuuuu
@babebebibobuuuuu 4 года назад
@@derekbanas This very Design Pattern ended up on the test this morning so thanks I guess haha
@derekbanas
@derekbanas 11 лет назад
Great! You're very welcome :)
@constantinebindas5445
@constantinebindas5445 10 лет назад
Every video from this course helps me to obtain clear understanding of dedicated pattern. Nice work! One remark about Decorator Pattern. You've forgot to implement decorators for meat stuff and olives to obtain perfect pizza :)
@martinkohl175
@martinkohl175 8 лет назад
Great video on the Decorator pattern Derek! Loved it!
@derekbanas
@derekbanas 8 лет назад
+Martin Kohl Thank you :) I'm glad it helped
@derekbanas
@derekbanas 11 лет назад
Thank you, but you don't have to do that. I'm not one of the guys that asks people to like and favorite everything. The fact that you find them useful is enough for me :)
@TheRedNaxela
@TheRedNaxela 6 лет назад
learning for my software engineering course for university right now and have to learn all of these by heart and these videos are very helpfull thank you
@derekbanas
@derekbanas 6 лет назад
I'm happy they were helpful :)
@derekbanas
@derekbanas 11 лет назад
You're very welcome :)
@SpMeKP
@SpMeKP 7 лет назад
You should be hired as a tutor at my college. You just saved me 5 hours to say the least, while providing me with information in the most appropriate way. And this is not the first time...
@derekbanas
@derekbanas 7 лет назад
Thank you :) I'm here for free when ever I can be of help
@derekbanas
@derekbanas 11 лет назад
Sorry, but I'm not sure what you are trying to do. Send me a message on youtube, or and email derekbanas@verizon.net
@glacagnina
@glacagnina 10 лет назад
Absolutely the best I have ever seen in video programming tutorials! You are doing a fantastic job!
@bestof1506
@bestof1506 5 лет назад
He sounds a little bit like Andy from The Office (Ed Helms)
@AsliAmine
@AsliAmine 11 лет назад
Incredibly easy to learn !!!! THANK YOU !
@ashdavv
@ashdavv 7 лет назад
Thanks for the video .. They are really helpful .. Rather than reading the GangOfFour book this is much precise and better to be done over a weekend
@derekbanas
@derekbanas 7 лет назад
Thank you :) The goal was to make the GOF book easier to understand
@Vendettaaaa666
@Vendettaaaa666 9 лет назад
Hey Derek, correct me if I'm wrong. So the basic difference between Abstract Factory design pattern and Decorator design pattern is: 1. When you can create an object many different "definite" ways, use "Abstract factory design pattern". Also disadvantage is, you have to create a factory for every possible combination. More of a static factory. 2.When you can create an object many different "indefinite" ways, use "Decorator design pattern". Here you can dynamically combine any possible combinations. More of a dynamic factory.
@derekbanas
@derekbanas 9 лет назад
Vendettaaaa666 Absolutely those are the main differences.
@ablemorghon
@ablemorghon 11 лет назад
Very nice. All your tutorials are great, thanks!
@facundostratocaster356
@facundostratocaster356 4 года назад
Awsome tutorials, I'm preparing for my exam with your videos!! The examples are excellent
@derekbanas
@derekbanas 4 года назад
Thank you :) I wish you the best on your exams
@derekbanas
@derekbanas 11 лет назад
Thank you :) i did my best with them. I found an answer for your question that I agree with here: stackoverflow. com/questions/2166632/can-you-remove-a-decorator
@climbsnakedike
@climbsnakedike 10 лет назад
Excellent, concise yet easy to understand. Thanks you!
@derekbanas
@derekbanas 10 лет назад
Thank you very much :) I'm very happy that you enjoyed it.
@muditmarda2150
@muditmarda2150 9 лет назад
Good Stuff! All the design patterns are well explained. Thanks! :)
@derekbanas
@derekbanas 9 лет назад
***** Thank you :) Your welcome
@jitendrakasaudhan6585
@jitendrakasaudhan6585 9 лет назад
This is superb place for learning design pattern. Thanks Derek..
@derekbanas
@derekbanas 9 лет назад
jitendra Kasaudhan Thank you :) You're very welcome
@deekshajuneja5
@deekshajuneja5 8 лет назад
The pizza example used in this video is very effective in understanding Decorator Pattern. The method of inheritance as described in the video is static and will not allow for changes in the code. Hence, it is important to use design patterns because good code is easily manageable and changeable. Using design patterns will allow the client to easily add new toppings to pizza, change the cost of each topping without having to make major changes in the code. An advantage of using decorator pattern particularly is that it uses the code already written and just extends it for additional functionality. The detailed coding example is very helpful in understanding how the decorator pattern functions. Though thespeaker makes an error while coding where he refers to methods as classes which might confuse new programmers.
@timleungck
@timleungck 10 лет назад
Thank you so much! Clear explanation, I love you!
@alltheway99
@alltheway99 10 лет назад
no wories, i just wantes to say something really :-) your lectures are very good
@PopeSweetJezus
@PopeSweetJezus 11 лет назад
This video is 1000 times better than how my teacher tried to explain it to us, why thanks ;)
@ayoubaid5296
@ayoubaid5296 10 лет назад
My Best channel to learn OOP and DP Great job guys
@derekbanas
@derekbanas 10 лет назад
Thank you :)
@derekbanas
@derekbanas 11 лет назад
That's funny :) I'm glad you liked it
@herp_derpingson
@herp_derpingson 11 лет назад
"Concrete Pizza" Sounds Delicious ;) 5:01
@TehPobo
@TehPobo 3 года назад
how was it
@herp_derpingson
@herp_derpingson 3 года назад
@@TehPobo I dont remember it was 8 years ago.
@andrewchavarria9227
@andrewchavarria9227 3 года назад
@@herp_derpingson I think I'd remember if I ate a concrete pizza
@justgao
@justgao 4 года назад
Great video! When I think about creating a pizza class with many different kinds of toppings, I might choose the builder pattern instead, so that my code for adding toppings can be linearly written instead of in the form of nested constructors. Are there any advantages of the decorator pattern over the builder pattern here?
@ehreut
@ehreut 11 лет назад
Great Videos! very well explained, great examples, just great, thank you very much!
Далее
Command Design Pattern
23:41
Просмотров 282 тыс.
Simplest Decorator Design Pattern in C#
10:55
Просмотров 25 тыс.
220 volts ⚡️
00:16
Просмотров 639 тыс.
АСЛАН, АВИ, АНЯ
00:12
Просмотров 1,4 млн
Visitor Design Pattern
13:31
Просмотров 276 тыс.
Prototype Design Pattern Tutorial
7:59
Просмотров 222 тыс.
The Smart Way of Using the Decorator Pattern in C#
12:37
Design Patterns: Decorator
17:21
Просмотров 25 тыс.
Strategy Design Pattern
11:32
Просмотров 746 тыс.
5 Design Patterns That Are ACTUALLY Used By Developers
9:27
220 volts ⚡️
00:16
Просмотров 639 тыс.