O'Reilly logo

Design Patterns in Java™, Second Edition by William C. Wake, Steven John Metsker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 an output 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required