Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
The purpose of the minimalist example is to expose a design pattern's structure. However, with the Strategy pattern, a more robust example may actually do a better job of showing the pattern's features, because it places the pattern in a more practical context in the bare bones example.
In this next example, we envision a Strategy pattern used with a clown employment agency. The agency has a number of clowns it represents. Clients call for different clown venues—circuses, birthday parties, political conventions. They want either a particular clown or particular clown acts (skits) or tricks they can perform. To create a flexible program for the clown agency, each of the skits and tricks has been created in separate algorithms. The algorithms are encapsulated, and the clown characters delegate their performance skills to the encapsulated algorithms—strategies.