This pattern provides a simple way to manage one or more contexts. In current computer graphics and multimedia it has become a common convention to store and use more than one context - or environment of execution. This pattern should provide a simple and understandable interface to switching, editing, sharing, destroying and creating contexts.
Context Manager
A secretary is an excellent example of the problem that needs solving with this pattern. While working a secretary often has to complete multiple tasks concurrently. To complete his tasks the secretary must have a workspace set-up to facillitate each task. These workspaces might be files, a computer with a spreadsheet, a typewriter with company letterhead loaded, or a set of letter boxes with labels indicating IN/OUT/Pending/etc. Occasionally the secretary will need to use pieces of two or more of these workspaces to finish a task. The secretary is also often asked to add a new task, and hence a new workspace. Through his day he must work on each task, facing the workspace in his office chair to do so. As a task is completed, the workspace can be dissasembled and put away. If the secretary had to put away the workspace every time that they switched to another task, they would spend their whole day setting up and taking down their worspace (stop stapling, put the stapler away, put the collated papers into a stack on the desk - take the stapler out, re-colate papers, start stapling). The preservation of context or workspace is key to this pattern. It is also imperative that the secretary knows where each workspace (context) is, if he couldn't find the papers to staple and stapler he couldn't staple them.
This pattern can be applied in many places including thread management and graphics context management. You can recognize when this pattern is applicable by the desire to have independent environments or collections of variables and the ability to manage them.