Strategy Design Pattern

Strategy Design Pattern

Derek Banas

11 лет назад

744,117 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Aissa Bedr
Aissa Bedr - 01.08.2023 15:27

Thanks.

Ответить
Chintu Karthi
Chintu Karthi - 06.07.2023 05:18

thanks for this gem. It's simple and understandable :)

Ответить
Online I.T Skills
Online I.T Skills - 26.04.2023 12:21

Thanks for such a nice video

Ответить
sean peart
sean peart - 13.01.2023 04:03

2023

Ответить
Monster Hunter Adventurers
Monster Hunter Adventurers - 02.11.2022 04:57

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

Ответить
Gustavo Salmerón
Gustavo Salmerón - 11.10.2022 07:43

I always had trouble learning the strategy pattern, but now I finally get it. You made it so simple! Thanks!

Ответить
Jacopo Pecchini
Jacopo Pecchini - 01.09.2022 11:41

thank you so much.

Ответить
Sakhawat Hossen
Sakhawat Hossen - 01.08.2022 16:45

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.

Ответить
Bishnu Pada Chanda
Bishnu Pada Chanda - 23.07.2022 16:00

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?

Ответить
Michael Mhizha
Michael Mhizha - 08.04.2022 02:14

great video, it helps a lot

Ответить
Moses
Moses - 22.03.2022 03:00

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.

Ответить
Jasper
Jasper - 21.03.2022 07:42

Brilliant. Thanks Derek. You are the hope to the universe. :)

Ответить
Raj G
Raj G - 06.03.2022 18:33

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 ?

Ответить
PurpleRainbow紫虹
PurpleRainbow紫虹 - 27.02.2022 11:35

Amazing!!!!!!
It change design pattern to so easy!

Ответить
Anri Kezeroti
Anri Kezeroti - 04.02.2022 00:48

The best way is not to read a book, I would rather watch this 😃

Ответить
poetSonia islam
poetSonia islam - 18.01.2022 07:49

hei iam girl of Bangladesh.. this vedio is good..

Ответить
Vlad Spalatelu
Vlad Spalatelu - 28.10.2021 16:24

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?

Ответить
Huy - Tech | Tennis | Pickleball
Huy - Tech | Tennis | Pickleball - 07.10.2021 02:07

A gem of the internet.

Ответить
Armand
Armand - 05.10.2021 23:06

Great video thank you

Ответить
Danish
Danish - 13.08.2021 04:43

Why it's name is strategy pattern ?

Ответить
Lie Chang
Lie Chang - 30.07.2021 18:21

all this fly here fly there, really kinda confusing. but the diagram that illustrate the concept really helps

Ответить
Emmanuel Lazarte
Emmanuel Lazarte - 03.07.2021 22:55

Thx

Ответить
Valentin Döring
Valentin Döring - 11.06.2021 01:48

NIce, thank you

Ответить
Mukti Desai
Mukti Desai - 05.04.2021 23:45

why is the entire video blurred?

Ответить
iffy aka
iffy aka - 03.04.2021 08:18

Amazing!

Ответить
Unknown
Unknown - 20.03.2021 08:17

@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!!

Ответить
noble_mick mick
noble_mick mick - 14.03.2021 12:57

I love it somebody call it Adapter , maybe but your instructing is inspiring :)

Ответить
salah eddine __
salah eddine __ - 12.03.2021 19:23

I would love to see a flying dog in 2021.

Ответить
Rick Li
Rick Li - 08.03.2021 22:55

多谢

Ответить
Cryp!0G00n
Cryp!0G00n - 06.03.2021 22:35

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.

Ответить
Revving By Shazi
Revving By Shazi - 21.02.2021 01:56

Pleaseeee make a video on dependency injection!

Ответить
JYSER roshan seeam
JYSER roshan seeam - 04.02.2021 14:16

you are awesome!

Ответить
Jake
Jake - 01.01.2021 19:17

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 ?

Ответить
Dovid Samuels
Dovid Samuels - 16.12.2020 10:27

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?

Ответить
Ehsun
Ehsun - 16.12.2020 08:19

The class is called "Animal", not "Animal dot java". :(

Ответить
Boston Lights
Boston Lights - 17.11.2020 04:36

Old is Gold.
Never imagined video from 2012 is still the best one out here

Ответить
alaa mezain
alaa mezain - 05.10.2020 19:46

and DI was born

Ответить
Sagar
Sagar - 05.10.2020 16:50

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)

Ответить
Mister Sir Random Guy
Mister Sir Random Guy - 18.09.2020 11:21

the Link to Best Design Patterns Book does not work FYI

Ответить
Magical Life
Magical Life - 18.09.2020 10:32

Very nicely explained

Ответить
Marcelo Sitonio
Marcelo Sitonio - 15.09.2020 01:56

great strategy!

Ответить
I uee
I uee - 14.09.2020 22:51

thanks for the video bro derek

Ответить
Pedro Gomes
Pedro Gomes - 10.09.2020 20:37

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!

Ответить