Jump to content

State pattern

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by TakuyaMurata (talk | contribs) at 20:49, 3 January 2003. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

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

See also: StrategyPattern, DynamicClassification, RunAndReturnSuccessor

DualityBetweenStateAndClass gives a more philosophical discussion of why an object's "state" deserves to be modeled in a separate class.



http://rampages.onramp.net/~huston/dp/state.html

http://wiki.cs.uiuc.edu/PatternStories/StatePattern


In Chapter 9 of PatternLanguagesOfProgramDesign volume three, PaulDyson and BruceAnderson present seven "state" patterns in a PatternLanguage, explaining the costs and benefits of various implementation strategies of this pattern. (CategoryGroupsOfPatterns)


CategoryPattern | CategoryBehavioralPatterns