There’s a way to think about design patterns that stuck with me. Like Venkat said at the beginning of his 2019 Devoxx talk, they are a lot like grandma’s recipes. We all love when our grandmas cook for us. But try to ask for the recipes —the amount of flour or sugar to use is never precise. And when you prepare the food yourself, it comes out completely different.

In our biggest Java project at Evojam right now, we have tweaked the recipe for strategy pattern. We added our personal touch with a pinch of enums and functional syntactic sugar. As always, the easiest way to explain it is with an example. Let’s jump right into it.

Generated by Feedzy