Strategy : Design Patterns in TypeScript

Channel:
Subscribers:
24,900
Published on ● Video Link: https://www.youtube.com/watch?v=J7DtdyIIvMM



Duration: 4:03
0 views
0


https://www.amazon.com/dp/B0948BCH24 : ASIN B0948BCH24
https://www.amazon.com/dp/B094716FD6 : ASIN B094716FD6

Documentation : https://sbcode.net/typescript/strategy/

The Strategy Pattern is similar to the State Pattern, except that the client passes in the algorithm that the context should run.

The algorithm should be contained within a class that implements the particular strategies interface.

An application that sorts data is a good example of where you can incorporate the Strategy pattern.

There are many methods of sorting a set of data. E.g., Quicksort, Mergesort, Introsort, Heapsort, Bubblesort. See https://en.wikipedia.org/wiki/Sorting_algorithm for more examples.

The user interface of the client application can provide a drop-down menu to allow the user to try the different sorting algorithms.

Upon user selection, a reference to the algorithm will be passed to the context and processed using this new algorithm instead.

#strategyPattern
#typescriptStrategy
#strategyPatternTypescript







Tags:
Design Patterns In TypeScript
TypeScript
Design Patterns
strategy
strategy pattern