Strategy Pattern - Design Patterns (ep 1)

  Рет қаралды 1,521,405

Christopher Okhravi

Christopher Okhravi

Күн бұрын

Пікірлер: 1 800
@vaibhav4196
@vaibhav4196 10 ай бұрын
Just stumbled upon this gem in 2024, and 8 years down the road, this video remains an absolute treasure! The explanation is beyond awesome - PURE GOLD! 🌟 Grateful for the timeless content! 🔥
@bobbob-gv1ev
@bobbob-gv1ev 6 ай бұрын
If you want a text version the examples are taken from Head First: Design Patterns -- excellent read
@miguelcerne1150
@miguelcerne1150 6 ай бұрын
Me too, man! I always wanted a good and simple material to guide me through Design Patterns, this is just GOLD.
@edwinzone5807
@edwinzone5807 5 ай бұрын
Same!!!!
@CSKnowledge007
@CSKnowledge007 28 күн бұрын
same
@TheMentalGentelman
@TheMentalGentelman 3 жыл бұрын
I cannot stress enough how good this video is. A lot of tutorials don't bother editing the empty space between sentences, but you do. Props, and I hope your future is bright.
@zanarkdev3904
@zanarkdev3904 3 жыл бұрын
This playlist is almost 5 years old and yet it is THE BEST playlist/video on Design Patterns. Thank you so so much for making everything so easy to understand.
@ahmedhany8339
@ahmedhany8339 Жыл бұрын
almost 7 years now, still the best
@dangascoigne6678
@dangascoigne6678 Жыл бұрын
You are the first person I've come across on KZbin that simply and atriculately explains dependency injection. Thank you.
@oluwatobitobias
@oluwatobitobias Жыл бұрын
This is making the top ten best educational content on KZbin for me... this method..."break down the teaching from a reputable book"
@Ish-YouTube
@Ish-YouTube 10 ай бұрын
In the middle of the video I just stared at your messy board and went crazy by the fact I understood every single word and every messy arrow!!! How did you do it??? Man you're blessed, you're a perfect teacher!
@TfYouLookinAt1
@TfYouLookinAt1 9 ай бұрын
He cared, that's how.
@crystalkewe
@crystalkewe 8 ай бұрын
Finally, one of those odd times KZbin actually recommends something of use! THANK YOU!
@andiespencer854
@andiespencer854 2 жыл бұрын
This is the best explanation i've gotten throughout all my pattern researches on youtube. The explanations are so detailed as though it was done under the assumption that the views are new to design patterns overall which is honestly the best way.
@cameronsin1942
@cameronsin1942 7 жыл бұрын
Broooo! if you were a professor in my school, i'd add all your classes in a heartbeat. Thanks for all the great videos. Subscribed and best wishes!
@lucas_badico
@lucas_badico 5 жыл бұрын
@johngreen said something like this... He is a professor. @Christopher, a professor that we choose to listen and follow. This take us back to the begining of the master and aprendiship relations. Where the student choosed the master and the master choosed what will became of your teachings.
@ahnmichael1484
@ahnmichael1484 4 жыл бұрын
Honestly thank you thank you thank you - I feel like crying right now at how much I *didn't* understand at the beginning of the video and how confident I feel now at the end of the video.
@regevson2244
@regevson2244 7 жыл бұрын
please keep on with this series. Your explaining is sick!
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Thanks. I'll be sure to :)
@aaraksheet1
@aaraksheet1 7 жыл бұрын
"Sick" is used as an inverted meaning.
@mgrycz
@mgrycz 6 жыл бұрын
Thanks, captn!
@TJ-zs2sv
@TJ-zs2sv 6 жыл бұрын
explaining is sick.....???? Really?
@ke9n
@ke9n 6 жыл бұрын
Yeah best, most understandable videos I've seen and the lighting is intimate like we're right there in the room and he's explaining it simply like an awesome friend lol
@kumarchandan6336
@kumarchandan6336 6 ай бұрын
I have cracked Low Level Design interviews in companies like Microsoft, Amazon, Atlassian, Flipkart, etc with the help of your videos. Your videos are really helpful. Keep up the good work.
@ChristopherOkhravi
@ChristopherOkhravi 6 ай бұрын
Wow. I’m happy to hear that! Thanks for sharing. 🙏😊 And congratulations!
@Arkatori
@Arkatori 4 жыл бұрын
i love how he teaches AND his accent! I was smiling so much
@Roxarras
@Roxarras 4 жыл бұрын
This playlist really helped me during my studies. Now, after finishing my studies and coming back to this playlist to refresh my memory, I can see I have forgotten quite some things. Thanks again for making me learn and having fun while doing it!
@gigajoules6636
@gigajoules6636 5 жыл бұрын
I love your energy. Such a refreshing change from staring at a visualstudio window for hours
@Sapphiamur
@Sapphiamur 4 жыл бұрын
ooh, i love your explanation! perfectly understandable and showcasing where the pattern helps with examples. thank you so much!!
@dnbndu
@dnbndu 3 жыл бұрын
I Love your Girlfriend.
@EspatiallyGood
@EspatiallyGood 3 жыл бұрын
Chris! Total Legend!! Your technique for taking cold "text book" definition, and turning it into something human and understandable is utterly brilliant. Wish I had a tutor or mentor like you to learn from. Thank you so much for dedicating your time to make these video's. I subscribed, liked, and will spread the word to my dev team.
@connietranhedberg5251
@connietranhedberg5251 3 жыл бұрын
I've spent so many hours trying to understand how to apply the strategy pattern. Thank you for both explaining it with UML and pseudo code - makes the whole difference!
@ievgeniiiablonsky1161
@ievgeniiiablonsky1161 8 жыл бұрын
That's is great! I've started the video just to watch it for a few minutes, just to check it out and watch it later. But I couldn't stop, it is so good! I love how you explaining, it looks like you are obsessed with it and it's great. Please continue doing that!
@ChristopherOkhravi
@ChristopherOkhravi 8 жыл бұрын
Haha thanks I'm glad it's useful :)
@MubashirAR
@MubashirAR 5 жыл бұрын
Whats the "3 ❤" next to your name?
@bernong1
@bernong1 3 жыл бұрын
This is the clearest explanation I have ever seen. What I needed was to understand how the design came about and how it is implemented and how the implementation works. You hit all these points so clearly. I have struggled understanding design patterns for years, how they are implemented and works. Keep it up. Super clear, concise.thank you. 10 stars!
@satyendrakumarsharma3513
@satyendrakumarsharma3513 7 жыл бұрын
Thanks Christopher! Your way of presentation is so expressive, it feels that the knowledge is being 'injected' into the mind. Please keep posting similar videos over other topics of Computer Science.
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
+Satyendra Kumar Sharma haha :) Thanks. I will indeed do. And thanks for watching.
@goffredo81
@goffredo81 4 жыл бұрын
coming from javascript, and having read a lot of different articles over this subject, i can say that your explanation about design patterns in OOP is so far the clearest explanation that can be found online. You did a great job. Thank you!
@BinarySymphony
@BinarySymphony 7 жыл бұрын
Very nice videos. The way you explain makes people sit and listen what you are speaking. That's very good. Also, you can give the ducks the power to be invisible. lol...
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Thank you very much for taking the time to comment. It makes me very happy to hear. About the ducks... you are the invincible programmer and only your imagination shall dictate the limits of your force. I support your invisible ducks :)
@ninakoch1799
@ninakoch1799 2 жыл бұрын
@@ChristopherOkhravi thank you so so much for this absolutely amazing video series on design patterns!! took a course at my university about this but never fully understood the design patterns until i binge watched your videoseries!! your are awesome!
@FernandoHernandez-nr1by
@FernandoHernandez-nr1by 2 жыл бұрын
Man, this video was so helpful! At first, when you read what the pattern was I thought I kinda understood it, and 10 minutes in I realized I had no idea what the pattern really is, but by the end of the video I really did understand it. You're great dude!!
@javierperezsanchez6601
@javierperezsanchez6601 7 жыл бұрын
This is hands down the most thorough explanation I have come across in a long time. Congratulations dude. This series is just awesome.
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
+Javier Perez Sanchez :D thank you for the very kind words and for taking the time to share them. I'm super glad it's useful :)
@Jjjabes
@Jjjabes 4 жыл бұрын
There are some people that are born to teach. You've taken what is fundamentally a dull af subject and made it entertaining.. thank you!
@BuildEver
@BuildEver 5 жыл бұрын
I'm glad KZbin recommended me this video!
@akshitarora470
@akshitarora470 2 жыл бұрын
Can't thank you enough man! I had a design problem to work at somone suggested to use strategies to solve it and I was totally blank! This has given me a great prespective. Going to watch the entire series, one pattern a day is the aim! Thanks again!
@atobatele
@atobatele 5 жыл бұрын
You are a gifted teacher. You break down complex things to very simple relatable bits. I hope you keep these videos coming.
@daniahmohammad6101
@daniahmohammad6101 2 жыл бұрын
Chris, I watched you videos about design patterns to prepare for a class that I skipped most of it is lectures due to the depressing online teaching, and I just finished my exam. I just want to thank you so much for the amazing lessons you taught me. I was able to refactor the codes easily because you explained the concepts in a very understandable way. I wish you all the best 🧡 *depressed eng student*
@Codefortyseven
@Codefortyseven 5 жыл бұрын
If only I would've received this level of explanation and visualization while I was in the university, my knowledge and understanding of these patterns would be so much better. I'm lucky that the poor quality of education was still able to land me a job as a software developer, which I've been doing as a profession for over 5 years now, but I'll be watching this series through because I think I would learn more from these videos than I did in the university. I'm trying to be optimistic it's still not too late to expand and deepen my knowledge.
@tassaron
@tassaron 2 жыл бұрын
Every time I learn about a design pattern, it's something I started figuring out for myself through trial and error over the years... But putting a concrete name on these strategies and patterns helps so much
@whitodev3472
@whitodev3472 7 жыл бұрын
now this is how you do a design pattern lecture, I understood everything! Thank you so much!
@ayushsharma1943
@ayushsharma1943 3 жыл бұрын
bro, where were you till yesterday. I found this video a few years too late but I am glad I found them. such a perfect and simple explanation. I had that "aha so that's what it meant" moment.
@naeroforceofficial
@naeroforceofficial 4 жыл бұрын
This is a super playlist. As a complete newbie to design patterns I was lacking of some basics, you made me understood the Strategy Pattern, Interfaces, UML and also some hints on naming... In 30 minutes. Thank you!
@mandeepmann1835
@mandeepmann1835 4 жыл бұрын
Just started looking at design patterns for interviews and am a little confused. Then came across your videos and they are amazing. Clearest and most simple explanations out there. Godsend!!
@acupsf
@acupsf 2 жыл бұрын
I've read the GoF book a couple times, but for some patterns, never really got them Your series really made them clear now Thank you for a great series on the design patterns!
@ChristopherOkhravi
@ChristopherOkhravi 6 ай бұрын
Thank you very much! 😊🙏
@sunnyshang4350
@sunnyshang4350 4 жыл бұрын
Your explanation is soooo good. I do not come from a CS background and recently was recommended by a friend to read this book, head first design patterns. I read this part of the book twice and was still digesting it. But your video made it all make sense. Really want to let you know how meaningful your video is for me and people like me. Thank you
@xFailGameR
@xFailGameR 4 жыл бұрын
For years I've been searching for a good design patterns course, luckily KZbin recommended your videos and finally I am able to understand, keep going man, you helped me a lot. I was afraid that you quitted KZbin like every other programming teacher, after seeing this video was uploaded 3 years ago 🤛🏻🙏🏻
@vitaliymashchenko
@vitaliymashchenko 5 жыл бұрын
It's the best book about design patterns ever. I've read 6 books about patterns and I like it the most.
@quintonwilson8565
@quintonwilson8565 4 жыл бұрын
I read Chapter 1 from the book and I'm watching this video..... HOLY FUCK, YOU'RE PHENOMENALLY GOOD at breaking things down and explaining them.
@s1mpl3_
@s1mpl3_ 5 жыл бұрын
I'm usually a book guy, as most of the tutorials are either hard to follow or just the explanation is not good enough. But thanks to this video I can finally say, that I fully understand the strategy pattern. Thanks you!
@terigopula
@terigopula 3 жыл бұрын
Legend spotted ❤️ your content is 100% worth paying for. Kudos to you to make it available for free. U rock Chris 💜😄
@AnthonyBrindley
@AnthonyBrindley Жыл бұрын
You are a legend. I literally tripled my income by watching your videos, implementing and understanding what you're talking about and demonstrating it to a potential employer. Your videos changed my life! Thank you so much!
@antoniadieterich72
@antoniadieterich72 4 жыл бұрын
This was the best explanation of the strategy pattern I've heard so far! When you explain it, it suddenly seems easy!
@ZigzagKazak
@ZigzagKazak Жыл бұрын
I love your lessons. Fast, clearly articulated, concise. 10/10
@mikesmale1853
@mikesmale1853 6 жыл бұрын
Well, that was 30 minutes well spent, thank you!
@RajivBandaru
@RajivBandaru 4 жыл бұрын
Hands down the best series of videos on design patterns. Referring to his videos I have been able to clear my design patterns examination with flying colours. I would recommend his series anytime to anyone. Thank you Christopher Ockhrawi for this wonderful series...
@Сергей-ж5т8ы
@Сергей-ж5т8ы 5 жыл бұрын
When you're said introduction, I heard introDUCKtion😂
@alaamansour6088
@alaamansour6088 3 жыл бұрын
lol
@KanchanDevi-ms4en
@KanchanDevi-ms4en 3 жыл бұрын
yyogofjddj@@alaamansour6088 I ckckkfkrkekrk
@KanchanDevi-ms4en
@KanchanDevi-ms4en 3 жыл бұрын
fuej j h you fufhfu
@abhilashpatel3036
@abhilashpatel3036 3 жыл бұрын
In the book the first example is about ducks
@knvssandeepbolisetti5008
@knvssandeepbolisetti5008 5 жыл бұрын
Best professor ever seen After these videos no need to see the textbook for design patterns i'll suggest only him . i wrote my exams well after completing the videos
@HologramJay
@HologramJay 3 жыл бұрын
I had that 'aha' connection while watching this. Thanks man.
@olmanmora21
@olmanmora21 3 жыл бұрын
I can barely realize this video is 35mins long, you caught my attention the whole time, your explanation goes beyond simple boring design patterns theory, thank you sir, you've got a new subscriber.
@kyonru
@kyonru 7 жыл бұрын
Great job, even for a no-native speaker who is learning english like me, this was really helpful. I understood everything! I'll be waiting for more videos!
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Robert Juamarcal thanks! Makes me glad that it's understandable :) Btw ofc also I am a non-native English speaker. But we get better day by day right? :)
@kyonru
@kyonru 7 жыл бұрын
Yeah, we do xD
@atikaakmal3661
@atikaakmal3661 7 жыл бұрын
could u explain Composite behaviour
@atikaakmal3661
@atikaakmal3661 7 жыл бұрын
Hiii could u explain Composite behaviour
@johnsonvaughn2366
@johnsonvaughn2366 Жыл бұрын
OMG this content is the most simplifying design patterns. I don't even stress about it and mind blow when you write simple code. Thank you for your time and video.
@cuonginfosys
@cuonginfosys 7 жыл бұрын
Great effort! You simplify the difficult things. Really appreciate your work! PS: Looking forward to your next videos
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Cương Tạ Văn thanks! I appreciate you taking the time to comment :)
@ZealGames
@ZealGames Жыл бұрын
You have a great way of concisely integrating examples into a lesson without understating the examples' complexity. Thanks 👍
@walchandwarik3167
@walchandwarik3167 7 жыл бұрын
Dear sir, you are simply best.
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
+Walchand Warik Thank you sincerely for the kind words. And thanks for watching :) You guys are the best for supporting the channel :)
@guruputramahalingappa695
@guruputramahalingappa695 2 жыл бұрын
Sir, you are really my GURU now, I struggled a lot to get this kind of Guide. Basically I from poor family, finished my engin in a small college, but interested to learn this DP from expert like you. Now it got fulfilled after watching your first video. Thank you so much sir. Om Guruve namaha. :)
@joseramondiazarceo4063
@joseramondiazarceo4063 5 жыл бұрын
A hidden benefit from this is that makes the code more testable : )
@yaoxiongliang9483
@yaoxiongliang9483 3 жыл бұрын
It’s not hidden. Code reuse already means easier testing.
@IBRAHIMDEMIREZ
@IBRAHIMDEMIREZ 2 жыл бұрын
Not only the way how you explain and not how manage the video but how you exchange the information... its like you though the information to my brain. Really effective, only I can say that brilliant!
@professorfontanez
@professorfontanez 5 жыл бұрын
I've must have watched this video a million times and it just hit me today that this video also illustrates a very powerful design pattern: Null Object Pattern. NoQuackBehavior and NoFlyingBehavior are basically Null Objects.
@annybevilacqua6181
@annybevilacqua6181 2 жыл бұрын
Not even one minute into the video and I already feel this is gonna be great!
@YazanAlaboudi
@YazanAlaboudi 5 жыл бұрын
Watching this was a blast! Thank you so much for this video. I'm looking forward to the rest of the series. Great job stressing on semantics. I think we need to further emphasize on that in our dev communities
@TheRadicalCentrist.1776
@TheRadicalCentrist.1776 4 жыл бұрын
Outstanding. I've done software engineering for 25 years. I find design patterns very confusing in book form, even though I end up doing them in practice because they just make sense. But your explaination I can follow very easily. Well done.
@Ryuk3027
@Ryuk3027 6 жыл бұрын
I wish I had a co worker like you ! Amazing video, so much clarity, depth with examples and yet so simple :) I'm going to watch other videos like it were a season of Game of Thrones :D One suggestion though, I was really hoping to see an example code of how I'd actually instantiate the Duck class now through code since I have all the options for composition.
@guilhermemallmann2251
@guilhermemallmann2251 5 жыл бұрын
Man, I Work at KingHost, a WebHosting Company from Brazil, I'm a Junior PHP developer and I needed to make a code review from a collegue that used the dessign pattern strategy. I never understang it right, until I saw your video. Man, you're great! I completely understood the point of using strategy with only 35 minutes listening to you. I will watch all your videos about design patterns to learn more and I've subscribed to your channel. Please, keep up this good work, a hug from Brazil
@_Zephon
@_Zephon 6 жыл бұрын
Simply amazing. Start studying design patterns here and your channel is awesome. Excelent explanation. :) Greetings from Brazil o/
@mauvezebra
@mauvezebra 2 жыл бұрын
With your energetic explanation. I understan design pattern a lot more, and finally got the job I want. Thank you so much Christopher!
@sandeepsachan1465
@sandeepsachan1465 7 жыл бұрын
I Appreciate, Christopher. And I think the publisher should publish this video as part of the book :)
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Awesome comment :) :) :) Thanks! Much appreciated.
@tzhynt
@tzhynt Жыл бұрын
I thoroughly immersed myself by reading book prior to watching your video, and as a result, the knowledge became deeply ingrained in my mind. I genuinely appreciate the valuable content you provided
@nguyenxuanson-fgwhcm3471
@nguyenxuanson-fgwhcm3471 4 жыл бұрын
Not being able to fly is a flying behavior, I laughed so hard at this part
@halivudestevez2
@halivudestevez2 3 жыл бұрын
I learnt that point of view for 4 years at the college... zero distance is a distance too, empty set is a set too....
@chris7263
@chris7263 11 ай бұрын
I'm sure I've also just progressed far enough in learning that I am able to understand better than I used to, but this is the first explanation of a Design Pattern that I completely followed without getting lost, and that's gotta be to your credit too. Thank you for this!
@heraldo623
@heraldo623 5 жыл бұрын
That pattern simply turns algorithms into objects and so give you full control of dependencies. Hierarchy doesnt give you full control because of the Liskov Subistitution principle, the subclass must have the properties of parent class.
@globalincident694
@globalincident694 4 жыл бұрын
The thing is though, strategies aren't all good. They are useful when the equivalent hierarchy would result in people creating lots of subclasses of your class, and in those subclasses sharing lots of code between each other in a way that makes doing it as a hierarchy complicated. But in my experience that doesn't happen that often.
@planomustang1
@planomustang1 4 жыл бұрын
@@globalincident694 - In my opinion, the Liskov Substitution principle points out a flaw/limitation in OO languages, rather than a principle. In real world programming, your rarely get hierarchies/taxonomies that can obey LSP, yet remain useful. I like the concept of "adhoc polymorphism" in languages like Haskell. Model the hierarchies/taxonomies as best you can, but let the differences exist. The compiler will tell you when you go wrong.
@globalincident694
@globalincident694 4 жыл бұрын
@@planomustang1 I wouldn't say Liskov substitution is a flaw. It's present to an extent in Haskell too - if you are creating an instance of a class, the instance also needs to have the methods of the parent class. If you're having a problem with it, that usually means there's a flaw in your class structure - maybe that class shouldn't have that method - rather than a problem with liskov substitution.
@planomustang1
@planomustang1 4 жыл бұрын
@@globalincident694 No. Haskell allows adhoc polymorphism. In other words, you don't have to implement a parent's method, if it does not apply to the child. The compiler will only complain, if something tries apply the parent method to the child. Javac/C++ will complain at compile time, though there is no evidence the method is needed on the child. That is why LSP points to a problem, rather than a solution. OO models are too strict. Adhoc Polymorphism is a good thing. FYI, I learned about LSP in 1996.
@gustawbobowski1333
@gustawbobowski1333 2 жыл бұрын
​@@planomustang1 why implemnent a parent method in a child if it's inherted?
@Gr33nAv3ng3r
@Gr33nAv3ng3r 4 жыл бұрын
This video was the single most effective resource I have seen. I was sooo stuck trying to wrap my head around how to use Strategy Pattern to solve this problem I was working on. My intuition lead me to Strategy Pattern but I didn't realize how much I didn't understand. Thanks you Soo Soo much!!!
@matthiasauswoger7994
@matthiasauswoger7994 7 жыл бұрын
With enough thrust, rubber ducks fly quite well... ;-) But good video, thanks for that.
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Hahaha. True, true :) :)
@azolee
@azolee 2 жыл бұрын
I really like the way you present these DP's. Your videos are a source of inspiration for me, on how to present these DP's for junior/mid devs. Thank you, keep up the good work!
@Resok
@Resok 7 жыл бұрын
Great video, thanks for the detailed and well articulated analysis!
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Thank you for the kind words! :)
@jvsnyc
@jvsnyc 3 жыл бұрын
So many positive comments, all so well-deserved. It seemed all over the place while I was watching it but it just all comes together so well. Only comment is that "quack" is normally pronounced to rhyme with "black", "snack", "sack" and "track". Great video!
@mihailpopa3056
@mihailpopa3056 7 жыл бұрын
Good job! I like your comments and especially your references. Sandi Metz is indeed an excellent OOP advocate!
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Thanks! :) I agree. She's got some really inspiring talks. The "Nothing is Something" talk is on my mental list of top programming talks. In the sense that so many things just suddenly "clicked" for me.
@marekbugiel6893
@marekbugiel6893 5 жыл бұрын
@@ChristopherOkhravi Mind sharing rest of the list? :) Seems like something I'd like to know. Thanks for the vid, great job!
@tans.4355
@tans.4355 4 жыл бұрын
I looked around the web and landed here your explanations are very simple and clear and motivated me to refactor a bunch of stuff written in the past. Great Job Thanks. Will look fwd to more series from You.
@JAIDEEPMEISTER
@JAIDEEPMEISTER 7 жыл бұрын
Great video !!! Desperately waiting for the other patternssssssssssss .. 12 of them
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
+Singh haha thanks! Glad it's useful. More coming next week! :)
@friedcrumpets
@friedcrumpets Жыл бұрын
I’ve been trying to solidify this pattern to many for a while… this is the best explanation I’ve come across 🎉thank you
@aakashsinha6454
@aakashsinha6454 3 жыл бұрын
It's like Mr. bean is teaching... :-p
@gustawbobowski1333
@gustawbobowski1333 2 жыл бұрын
Years later, still a great explanation. Well done!
@curtisw0234
@curtisw0234 5 жыл бұрын
The strategy pattern seems like a workaround for languages that don't have lambdas
@uumlau
@uumlau 5 жыл бұрын
A lot of design patterns use abstract classes or interfaces to achieve what delegates/lambdas do. The classic Gang of Four book was published in 1995, so C++ was the standard of the time, and it didn't have delegates/lambdas yet, where the important part was to define the signature of the method. C++ could also use function pointers, but function pointers were just pointers and couldn't have explicit method signatures, hence the use of interfaces. It would be another decade or so before lambdas became common. So yeah, it's totally legit - and a lot lighter - to inject a lambda instead of a full blown class/interface hierarchy.
@marcpawl
@marcpawl 5 жыл бұрын
A lambda is an implementation of a one method interface. A lambda maps to a class with no name. You might want to check out c++ weekly which had a discussion on lambdas. Passing in a lambda is the ultimate strategy pattern example.
@Layarion
@Layarion 4 жыл бұрын
@@uumlau could you explain to a c# noob, how lamba's replace interfaces or this pattern? to me a lambda just seems like a nice way to use something once and move on.
@uumlau
@uumlau 4 жыл бұрын
@@Layarion Well, if a method takes an interface as an argument, a concrete instance of that interface can contain a method. The strategy pattern can be implemented by allowing any number of different concrete classes containing different methods (strategies). It is possible instead to take a Func or Action and supply different methods that way. In all cases, the method needs to have the same signature, but otherwise the particular method to be used can be specified at run time. Sometimes an Interface or Abstract class is more efficient, especially if you have a large family of methods with different signatures to specify for each case of the strategy. Usually, however, the need for a strategy pattern is a simple decision to replace a single method, not a family, in which case a delegate can be used (declared as a Func or Action), and then whatever lambda you send just needs to have the correct signature. I've used this in real life to implement business rules dynamically, where I have a lists of business rules that are declared as lambdas (which lets me edit/modify them individually as specifications change without rewriting code or decision trees), and I can just run a foreach of the appropriate list of rules against the state of the application. Notice how this not only allows for multiple families of rules, it is far more flexible than an Interface or Abstract class, where I would have to declare each new method in the Interface/class. Instead of declaring an extra method, I just add/remove from the list of lambdas, and the signatures of methods and business logic evaluation doesn't change. Only the specific lambdas change. Combine this with commenting each lambda with the English version of the requirement, and this makes for very readable code that even a novice can easily modify.
@oluwatobitobias
@oluwatobitobias Жыл бұрын
Cos down to it... books have the best structure of learning... thank you very much for this... I've always procrastinated on Design patterns... buh with this... I've gotten the book and I'll seat down to learn from you
@facundorodriguez92
@facundorodriguez92 7 жыл бұрын
Excellent video! I'm waiting for the next one. Greetings from Argentina!
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Facundo Rodriguez Thanks! It's coming super soon. Greetings from Sweden ;)
@israelkariti280
@israelkariti280 Жыл бұрын
Your passion to the subject is contagious. Very well presented
@ToskersCorner
@ToskersCorner 7 жыл бұрын
I've always wondered how ducks quack. Thanks!
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Hehe :)
@prezadent1
@prezadent1 7 жыл бұрын
They don't quack, they quach.
@felixjost8206
@felixjost8206 2 жыл бұрын
It's great how deep you dive into one pattern!
@Shannxy
@Shannxy 5 жыл бұрын
Holy shit thanks alot Mr.Bean!! So I already kinda knew what the strategy pattern was, but this whole video made it all ALOT clearer. I appreciate it greatly!
@sempercrescere6274
@sempercrescere6274 Жыл бұрын
I think 27.31 really highlights the point of strategy pattern: instead of creating subclasses that implement a parent class; we instead create different implementations of methods/algorithms (these are called 'stategies'). These strategies can then be "assembled together" to create an object with the configuration that we want. Using such 'configurable' objects in place of subclasses means that we can conveniently reuse the strategies in a 'horizontal' way.
@1993wik
@1993wik 5 жыл бұрын
Damn, that was amazing. Thank you, Christopher!
@daegudude1048
@daegudude1048 4 жыл бұрын
I'm not at the programming level that I need to watch this, but still find it very pleasant to watch, cheers!
@ChristopherOkhravi
@ChristopherOkhravi 4 жыл бұрын
I’m glad to hear and I think you’re doing the right thing when challenging yourself! I tend to consume a lot of content that’s above my level 😊 I come back to the videos every now and then and eventually it turns out that I perfectly understand most of it 😊😊 Thanks for watching!
@antagonisticapple9466
@antagonisticapple9466 4 жыл бұрын
My entire family was brutally savaged by a mountain duck. Your casual attitude toward their attacker is an insult to their memory.
@BinGanzLieb
@BinGanzLieb Жыл бұрын
did your entire family see this video?
@gdeveloper3309
@gdeveloper3309 Жыл бұрын
The mountain duck must've messed up his whole family hierarchy
@AidenElliott-ff2vt
@AidenElliott-ff2vt 11 ай бұрын
My dad crossed paths with a cloud duck, he is no longer with us. RIP your family, I hope you can find peace.
@adesojialu1051
@adesojialu1051 5 ай бұрын
The duck 🦆 is being reinvented into duck duck go😅
@psychotrout
@psychotrout 4 ай бұрын
Where’s that memory allocated?
@maxnovikov51
@maxnovikov51 4 жыл бұрын
I love you man, thanks. Super important the fact that you added example at the end to demonstrate the theory at action.
@juleswinnfield9931
@juleswinnfield9931 5 жыл бұрын
Sounds like he's talking about quantum physics with the quark...
@hassanmehdi1714
@hassanmehdi1714 4 жыл бұрын
quark but with a boston accent "quawk"
@unicode3402
@unicode3402 3 жыл бұрын
It's 2021 and this video was super interesting and easy to understand. I like the way you explain, simplify, exemplify and try your best to let us learn, and then even revisit the definition from the start of the video to showcase how much we've learned to this point, that it is now possible to understand the definition and it's meaning in programming. Thank you, this is actually pretty good, as patterns tend to look ridiculous thanks to unexplained terminology and overcomplicated examples. I'll keep watching this series, it's really helpful now on my finals.
@Drackomass
@Drackomass 7 жыл бұрын
This is so good...keep them coming :)
@ChristopherOkhravi
@ChristopherOkhravi 7 жыл бұрын
Thanks for watching. Glad it helps. Will do.
@mr.clickable3899
@mr.clickable3899 6 жыл бұрын
You all know shit about boxing
@anastasiyabarska8210
@anastasiyabarska8210 3 жыл бұрын
Thank you soooo much, your videos are perfect for those who have once read the book but need to refresh the bullet points. I really loved it, I would never find enough time to read the entire book once again
Observer Pattern - Design Patterns (ep 2)
49:47
Christopher Okhravi
Рет қаралды 571 М.
Decorator Pattern - Design Patterns (ep 3)
54:35
Christopher Okhravi
Рет қаралды 488 М.
Players vs Pitch 🤯
00:26
LE FOOT EN VIDÉO
Рет қаралды 133 МЛН
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 6 МЛН
Ice Cream or Surprise Trip Around the World?
00:31
Hungry FAM
Рет қаралды 21 МЛН
How principled coders outperform the competition
11:11
Coderized
Рет қаралды 1,8 МЛН
Design Patterns in Plain English | Mosh Hamedani
1:20:01
Programming with Mosh
Рет қаралды 1,4 МЛН
Factory Method Pattern - Design Patterns (ep 4)
27:21
Christopher Okhravi
Рет қаралды 553 М.
New divisibility rule! (30,000 of them)
26:51
Stand-up Maths
Рет қаралды 284 М.
8 Design Patterns | Prime Reacts
22:10
ThePrimeTime
Рет қаралды 437 М.
5 Design Patterns Every Engineer Should Know
11:51
Traversy Media
Рет қаралды 941 М.
Facade Pattern - Design Patterns (ep 9)
16:19
Christopher Okhravi
Рет қаралды 183 М.
The Strategy Pattern: Write BETTER PYTHON CODE Part 3
15:31
ArjanCodes
Рет қаралды 114 М.
Players vs Pitch 🤯
00:26
LE FOOT EN VIDÉO
Рет қаралды 133 МЛН