Комментарии:
Thanks.
Ответитьthanks for this gem. It's simple and understandable :)
ОтветитьThanks for such a nice video
Ответить2023
ОтветитьThank you very much for this video. I have hard time understanding design patterns and this helps alot. :) Preparing for an interview. Hope I can finish all today. thanks
ОтветитьI always had trouble learning the strategy pattern, but now I finally get it. You made it so simple! Thanks!
Ответитьthank you so much.
Ответитьit's 2022, Aug 1, I am watching this almost 10 years later . And it makes so much sanse. Thank you a lot for this video man. A true gem indeed.
ОтветитьWhat if we use enum for the behaviour like Fly. In the enum initially we can put two values - 1) Can't Fly, 2) Can fly. And we can add new enum values whenever we want like 3) Can fly high, 4) Can fly very high. What do you think?
Ответитьgreat video, it helps a lot
ОтветитьMy book gave modes of transportation as an example. Which is similar to this one but instead we could have had a Move interface and Dog could walk while Birds would fly.
ОтветитьBrilliant. Thanks Derek. You are the hope to the universe. :)
ОтветитьVery nice explanation ! Just wondering, can we use interface segregation here to create two interfaces like Flys and Can'tFly and the subclasses would implement the right one? Is it because, with this strategy approach, we would have the ability to change the behavior dynamically ?
ОтветитьAmazing!!!!!!
It change design pattern to so easy!
The best way is not to read a book, I would rather watch this 😃
Ответитьhei iam girl of Bangladesh.. this vedio is good..
ОтветитьHi Derek, great video!
Was wondering what would be the best approach in the following scenario:
Let's say you have a class called EnemyNPC, which is extended by 3 subclasses, Footman, Archer and Ship.
Each subclass has a different attack type (for eg: footman can only attack ground units, archers can attack air and naval units and ships can attack all three types (ground, air and naval)).
What would be the best approach in this scenario?
A gem of the internet.
ОтветитьGreat video thank you
ОтветитьWhy it's name is strategy pattern ?
Ответитьall this fly here fly there, really kinda confusing. but the diagram that illustrate the concept really helps
ОтветитьThx
ОтветитьNIce, thank you
Ответитьwhy is the entire video blurred?
ОтветитьAmazing!
Ответить@Dereck Banas Last time I watched your videos was in 2013 which helped me significantly back when I was at Uni, to see now that you now have over 1 million subscribers is astonishing. Congratulations!!
ОтветитьI love it somebody call it Adapter , maybe but your instructing is inspiring :)
ОтветитьI would love to see a flying dog in 2021.
Ответить多谢
ОтветитьWouldn't it be simpler to create a method called move() and that overrides in each of the subclasses or have a movetype object and define flying method and walking method etc. Also you could make a list of movetypes in animal and that way there is set of available move types to each animal type so a dog can walk, swim and run and a bird can dive, fly, jump, etc. It just seems a little overcomplication for a simple thing.
ОтветитьPleaseeee make a video on dependency injection!
Ответитьyou are awesome!
ОтветитьThe "CantFly" class just seems clunky. Wouldn't it be neater if inside tryToFly() method you have a "IS NULL" check on "flyingType" object ? So if null - return null, otherwise you call fly() method ?
ОтветитьQuestion: should the Dog class even be aware that there is such thing as flying? Would we use this technique when some subclasses (like dog) have no relevance to the added behavior, or am I just picking on the example and we would only use this technique when all subclasses need some choice of functionality for the behavior?
ОтветитьThe class is called "Animal", not "Animal dot java". :(
ОтветитьOld is Gold.
Never imagined video from 2012 is still the best one out here
and DI was born
Ответитьwhat happens if we want to change some parent class variables in the strategy? Should we extend parent class to the stategy classes?
(for example, in this case, to classes ItFlys & CantFly)
the Link to Best Design Patterns Book does not work FYI
ОтветитьVery nicely explained
Ответитьgreat strategy!
Ответитьthanks for the video bro derek
ОтветитьOne marvellous from our times is that we can simply search for whatever input and quickly find a highly capable professor like you, explaining a fairly simple concept in a much simpler way, in just 11 minutes, with a clear enough voice to be understood at 2x speed. Many others would take a 60 min class, or even more to explain the same. Thanks!
Ответить