DEV Community

Cover image for Strategy Pattern: simple but powerful
Chanh Le
Chanh Le

Posted on

Strategy Pattern: simple but powerful

Any time you want to add a new feature, think of it like another strategy of your system.
In your code, you just need to add another switch case for initiating your new strategy and all your new code will be added there.
No side-effects, no breaking-changes.
It's really that simple and yet powerful - Strategy Pattern.

Top comments (0)