State Pattern

Intent: Allow an object to alter its behavior when its internal state changes. The object will appear to change its class.

Duality Between State And Class gives a more philosophical discussion of why an object's "state" deserves to be modeled in a separate class. (Broken Link - not working 20120327) (Broken Link - not working 20071203)

In Chapter 9 of Pattern Languages Of Program Design volume three, Paul Dyson and Bruce Anderson present seven "state" patterns in a Pattern Language, explaining the costs and benefits of various implementation strategies of this pattern. (Category Groups Of Patterns)

See also(?): Client State

See original on