5 ms·
Something I've wondered for a while: how does the strategy pattern differ from just passing a function pointer?
by KaeseEs 16y ago
Something I've wondered for a while: how does the strategy pattern differ from just passing a function pointer?
- Deestan 16y ago> how does the strategy pattern differ from just passing a function pointer? It's just a verbose way to perform the same abstraction. Use it only if function pointers are unavailable or considered unsafe in your programming language.
- Raphael_Amiard 16y agoThere are a bunch of patterns that simply disappear, or are greatly simplified when you have first class functions in your language, namely, observer, strategy, visitor, and a bunch of others i can't remember right now