Chapter 23. Strategy
A strategy is a plan, or approach, for achieving an aim, given certain input conditions. A strategy is similar to an algorithm: An algorithm is a well-defined procedure that produces an output from a set of inputs. A strategy is a plan that pursues an output given a set of inputs. Usually, however, a strategy has more latitude in how to pursue its goal than an algorithm does. This latitude also means that strategies often appear in groups, or families, of alternatives. When multiple strategies are available, the logic that surrounds the strategies must select one and then execute it. Complexity in the selection and use of strategies can lead to complex and tangled code. You can clean up such code with the STRATEGY pattern. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access