Strategy Design Pattern Explained Using C#

preview_player
Показать описание

This episode explains the strategy design pattern and how to use it in a real world application. The strategy design pattern is a behavioral pattern that allows for an interchangeable execution path at runtime.

The strategy pattern is useful for situations where it is necessary to dynamically swap the algorithms used in an application. The strategy pattern is intended to provide a means to define a family of algorithms, encapsulate each one as an object, and make them interchangeable.

In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into source or machine code.
Рекомендации по теме
Комментарии
Автор

Thanks for your great explanation. This is a great start point for learning the Strategy pattern but it would be great if you could also explain how you would set a strategy object in a more elegant way (as you mentioned). Because after all, this pattern is used to replace the Switch statement with Polymorphism, but you're still using Switch.

behnamrasooli
Автор

Wow... A little over than a minute is what took you to explain this concept in a way I can understand. Seriously I watched a 35 min video including code and everything and still had no clue what the hell is going on. This was clear and to the point. Thank you.

cyberlord
Автор

I've been watching a lot of theoretical videos on this pattern. This pragmatic video is the most clear to me. Seeing how you inject specific methods into the general interface was exactly what I have been trying to find! Thank you so much!

kulpajj
Автор

Switch makes it ugly, save it as a property to a context object and pass it through a constructor and/or setter method. With switch youre not really decoupling bc you have to add the new case each time.

danm
Автор

One of the usages of the strategy pattern is getting rid of Switch/Case statement... not a good idea to use that to explain "strategy pattern"!

SharifYazdian
Автор

Hey, what other more elegant ways of selecting a strategy be?

helenabraga
Автор

Thank you for your great video tutorial, please tell me what theme are you using the in the Visual Studio? very beautiful theme.

yurashkraba
Автор

Fantastic explanation! Now I can go back to my PluralSight course and know what that guy was talking about.

deo-max
Автор

Thank you. Very clear and helpful. I've not yet found a design pattern book (I have four) or video that clearly explains design patterns. They always feel the need to add a lot of code to their examples that only confuses me. Often it's hard to know what part of the code is the pattern 🤥. Maybe you might consider doing a video on each of the patterns.

jimclay
Автор

A million thanks...I got it.u explain it in easy way.

ghazalehhsh
Автор

Good example is a key of understanding. Good explanation! ty

xelaksal
Автор

How is this different from Factory Design Pattern?

benjsoft
Автор

Hey, can you post here the code that you used on this project?

joaocaetano
Автор

Perfect explenation but sadly enough only one pattern video :'(

sv
Автор

Nice and clear explanation. Thank you.

malkitsaggu
Автор

Thanks for nice and simple vid..
Many thanks, keep doing great work..

YogeshSharma-hglx
Автор

Far away from clean code, but the idea is clear. Thanks

Volksdemenz
Автор

Isn't this the basic polymorphism?

mustafaturan
Автор

You are violating the open/close principle. In your example, you could have used different classes for it.

davidmata