Chapter 23. Strategy

A strategy is a plan or approach for achieving an aim given certain input conditions. A strategy is thus similar to an algorithm, a procedure that produces outputs from a set of inputs. Usually there is more latitude in how a “strategy” pursues its goal than in an “algorithm.” This latitude also means that strategies often appear in groups or families of alternatives.

When multiple strategies appear in a computer program, the code may become complex. The logic that surrounds the strategies must select a strategy, and this selection code may itself become complex. The execution of various strategies may also lie along different code paths, but in code that all resides in a single method. If the choice and execution of various ...

Get Design Patterns in C# now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.